tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From David Smith <d...@cornell.edu>
Subject Re: URLs with '../' and 404s
Date Thu, 08 Apr 2010 20:24:36 GMT
I strongly advocate server relative URLs which get rid of the whole
problem.  All that means is the URL becomes everything after the
servername & port in a full absolute URL.  That way it just plain works
and even minimizes the browser's understanding of how to compute an
absolute URL from a relative one.  It's even super easy to create them ...

request.getContextPath() + '/app/rel/path/to/myresource.blah'

It even takes into account if the app is deployed multiple times in
multiple contexts.  ie it's always the context in the current request.

--David

On 4/8/10 4:03 PM, Nikita Tovstoles wrote:
> Response.java in Tomcat src:
> http://kickjava.com/src/org/apache/catalina/connector/Response.java.htm
>
>
>
> On Thu, Apr 8, 2010 at 12:52 PM, Christopher Schultz <
> chris@christopherschultz.net> wrote:
>
> Nikita,
>
> On 4/8/2010 11:14 AM, Nikita Tovstoles wrote:
> >>> We use Wicket that periodically redirects to relative URLs
> starting with
> >>> '../'. I realize that's against the RFC (which says redirects are
> supposed
> >>> to be absolute), but I am not clear on why doesn't Tomcat collapse
> those
> >>> URLs in Response.toAbsolute()?
>
> I see no toAbsolute method in the HttpServletResponse class. Are you
> talking about some other toolkit?
>
> >>> -assume client is at http://localhost/app/home
> >>> -app responds to a request with 302 '../home.0'
> >>> -Response.toAbsolute() rewrites Location as 
> http://localhost/app/home/. .
> >>> /home.0 (spaces added to avoid spam filter)
>
> What does the response actually look like to the browser?
>
> >>> But, if client then issues a GET with exactly that URL - and not
> >>> http://localhost/app/home.0, Tomcat will issue a 404.
>
> Which URL?
>
> >>> In other words,
> >>> toAbsolute() produces a URL that Tomcat cannot service. Why the
> asymmetry?
>
> Again, where does toAbsolute come from?
>
> -chris
>>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>

> ---------------------------------------------------



Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message