tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Costin Manolache <cmanola...@yahoo.com>
Subject Re: [PATCH] forward instead of redirect for welcome files
Date Mon, 06 Jan 2003 19:57:43 GMT
Matt Parker wrote:

> 
> On Mon, 2003-01-06 at 12:14, Hans Bergsten wrote:
>> Matt Parker wrote:
>> > I'd like to suggest that catalina perform a forward, rather than a
>> > redirect, for requests that end with '/'. With a redirect, special
>> > configuration is necessary for proxy servers to work correctly. Also, a
>> > forward doesn't require an additional round trip to the client--a
>> > redirect must get back to the client and the client then issues a new
>> > request. I've tested this under Linux. Thanks!
>> 
>> You mean requests that do _not_ end with '/', right? Unfortunatly,
>> you must do a redirect in this case so that the browser can resolve
>> relative paths in the page correctly. If you use a forward, it can't
>> do so correctly.

> No, I mean requests that _do_ end with a trailing slash, but that should
> be resolved to one of the files specified in the web application's
> <welcome-file-list>. This is similar to Apache's DirectoryIndex
> directive. Maybe the following Apache documentation snippet can explain
> it more clearly than I can:
> 
> "The DirectoryIndex directive sets the list of resources
> to look for, when the client requests an index of the directory
> by specifying a / at the end of the a directory name."
> 
> For Apache, this is index.html by default. When Apache receives a
> trailing slash (e.g. /foo/bar/), it resolves index.html and returns it.
> Note that it does _not_ send a redirect to index.html. The redirect
> occurs only when there is no trailing slash at the end of a directory
> request (e.g. /foo/bar is redirected to /foo/bar/, which is then
> resolved to index.html)
> 
> So tomcat's behavior is actually going against what Apache does.


The problem is that once again the servlet spec defines a behavior that 
is different from the common practices on web servers.

The welcome-file-list can include more than index.html - you may have
foo/index.html, etc ( i.e. things in other dirs ). That means #anchors 
would break if we don't do redirect.

A second reason for doing redirects: a redirect will let the web server
handle the file serving ( if the index.html is a static file - or some 
resource that apache can handle ).

A third reason: it's safer :-)

Costin







--
To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>


Mime
View raw message