Search code examples
apachetomcaturl-routingreverse-proxymod-proxy

Tomcat serving URLs wrong with mod_proxy and apache


I've set up a host with apache to serve static pages and to use Tomcat to serve my web application (See this question). The static pages are server from

"http://myhost.com"

and the dynamic (tomcat) pages are server from

"http://myhost.com/myapp"

The mod_proxy makes sure the "http://myhost.com/myapp" are forwarded to tomcat server running on "http://myhost.com:8080".

The problem is that now you get the standard Tomcat introduction page on "http://myhost.com/myapp" but if you click on a local link (e.g. 'Status') on the left, it generates an URL "http://myhost.com/manager/status" while it should generate: "http://myhost.com/myapp/manager/status"

(The same is true for webapps installed under tomcat)

What should be changed in my configuration (apache, tomcat?) to redirect my tomcat links to the right place?


Solution

  • Have you set the ProxyPassReverse setting in your httpd.conf. This will overwrite the HTTP Header an you'll get to the correct request on the side of tomcat.