You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Mark Himsley <ma...@mdsh.com> on 2001/09/15 20:33:01 UTC

Apache sending Redirect when DirectoryIndex is index.jsp

Hi,

I've checked through my archives of this list but failed to find the
answer.

I have Apache 1.3.x serving static content and Tomcat 3.2.3 serving JSP
and servlets using ajpv12 as the link between the two.

Everything is working fine, except for one small point. I have the
DirectoryIndex set thus:

DirectoryIndex index.html index.shtml index.jsp

and I'm pushing JSP through Tomcat with:

AddType text/jsp .jsp
AddHandler jserv-servlet .jsp

This is fine, except if a directory index file is a JSP.

Lets say that the first file in a web site is /index.jsp. The client
browser sends "GET / HTTP/1.1". In this case the server replies "HTTP/1.1
302 Found" with a redirect Location of /index.jsp. This forces the client
to make a second request, this time "GET /index.jsp HTTP/1.1" and makes
the client's browser display the URL including the index.jsp.

This is not only bandwidth inefficient and ugly, but could cause problems
in the future. If the user bookmarks this page (it's a really good site
:-) and I go and change the first page from being index.jsp to index.html
then the users bookmark will be broken. I always thought that this was the
point of hiding the DirectoryIndex filename.

Could someone tell me how to 'hide' this 302 redirect, the way Apache does
for index.html and index.shtml (and any other file listed in
DirectoryIndex)?

Many thanks in advance.

--
Mark Himsley
In Acton