Webapp not working with proxy
Solution 1:
Your problem sums up to rewriting the absolute request URIs, which come from the application server. This can be done twofold:
- Apache2 can rewrite all URIs in the proxied content. It is rather difficult to catch all locations where an URI can occur.
- Tomcat7 can use the same absolute request URIs as the Apache server.
I would suggest the second way, since it is the easiest one. You should:
- Deploy the web application on
/my_demo
instead of/webui
. This may be as simple as renamingwebapps/webui
towebapps/my_demo
inCATALINA_BASE
. -
Configure Apache to proxy
/my_demo/
tohttps://example.com:4444/my_demo/
:ProxyPass "/my_demo/" "https://example.com:4444/my_demo/" ProxyPassReverse "/my_demo/" "https://example.com:4444/my_demo/"
PS: Using HTTPS for Tomcat is IMHO overkill, just configure an HTTP connector with the secure
and scheme
attributes changed, so that Tomcat knows it is being proxied through HTTPS:
<Connector port="4444"
scheme="https" secure="true"
proxyName="example.com"
proxyPort="443"/>
and change https
to http
in the ProxyPass
directives.