You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Christopher Schultz <ch...@christopherschultz.net> on 2022/09/19 14:20:18 UTC

Re: Unexpected double-slash in javax.servlet.forward.request_uri

All,

On 8/24/22 14:15, Christopher Schultz wrote:
> I haven't tried narrowing this down very much yet, but I have a 
> situation where I'm using javax.servlet.forward.request_uri to build a 
> URI and the string I'm pulling from there starts with TWO / characters 
> instead of one.
> 
> This ends up breaking navigation because the browser interprets this as 
> a protocol-relative URI instead of a host-relative URI and Bar Things 
> happen.
> 
> Has anyone ever seen anything like this?
> 
> Tomcat 8.5.latest.

I believe I have located the source of this. I'm using mod_proxy, 
mod_proxy_http, and mod_proxy_balancer to front Tomcat with httpd. Here 
was my balancer confioguration:

<Proxy "balancer://my-balancer">
   BalancerMember http://localhost:8217/
   ProxySet stickysession=JSESSIONID|jsessionid scolonpathdelim=On
</Proxy>

And here was an example ProxyPass directive that I tried with the 
Examples web app in order to determine if my application was responsible 
(it wasn't).

ProxyPass /examples/ balancer://my-balancer/examples/

That trivially reproduces the problem when visiting:
http://localhost/examples/servlets/servlet/RequestInfoExample

The problem is that my "balancer" configuration contains a trailing / 
character, and should have been:

   BalancerMember http://localhost:8217

(Note the missing trailing-slash.)

It's frustrating that it's so easy to make configuration errors like that.

-chris

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org