I have configured my VirtualHost example.com to proxy all requests to a Tomcat server

ProxyPass / http://localhost:8088/app
ProxyPassReverse / http://localhost:8088/app

This works fine for URLs like example.com/page, but for example.com and example.com/ I get this redirection response, which obviously leads to nothing.

HTTP/1.1 302 Moved Temporarily
Date: Wed, 06 Jul 2011 21:13:37 GMT
Server: Apache-Coyote/1.1             <-- the redirect comes from tomcat
Location: http://example.com/app/     <-- nonsense
...

What can I do to fix it? Preferably in the Apache config.

I'm using Apache 2 and Tomcat 7

link|improve this question

feedback

1 Answer

up vote 3 down vote accepted

I'm not exactly sure why, but this is the fix

ProxyPass / http://localhost:8088/app/
ProxyPassReverse / http://localhost:8088/app/

(Added slashes to the end)

link|improve this answer
2  
Slashes should always match. From the mod_proxy documentation: If the first argument ends with a trailing /, the second argument should also end with a trailing / and vice versa. Otherwise the resulting requests to the backend may miss some needed slashes and do not deliver the expected results. – Shane Madden Jul 6 '11 at 21:43
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.