Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question
add comment

1 Answer 1

up vote 5 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)

share|improve this answer
3  
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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