I have a web application on tomcat http://localhost:8080/WebApp/
The I have configrued Apache 2 (mod_proy) so that the web application is directly acces
I also had this problem and spent some time on it. I believe that if you change your apache httpd configuration to the following your redirect will work:
ProxyPreserveHost On
ProxyPass / http://localhost:8080/WebApp/
ProxyPassReverse / http://localhost/WebApp/
ProxyPassReverseCookiePath /WebApp /
This is because the tomcat response headers will contain the proxy headers (i.e. the Location header is http://localhost/WebApp
rather than http://localhost:8080/WebApp
) because ProxyPreserveHost is switched On.
As a footnote: This also works with you want to change your webapps context. Say you wanted to change the publicly visible context to context you can use the following:
ProxyPreserveHost On
ProxyPass /context/ http://localhost:8080/WebApp/
ProxyPassReverse /context/ http://localhost/WebApp/
ProxyPassReverseCookiePath /WebApp /context
For reference, I found this blog post extremely helpful: Reverse Proxying Tomcat Web Applications Behind Apache