You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Xavier Dury <ka...@hotmail.com> on 2014/09/22 10:48:06 UTC
Valve overriding contextPath behind a proxy
Hi,
The recommended approach when using a proxy in front of tomcat is to have the same context path on both side like this:
http://mycompany.com/myapp --> http://mycompany.lan:8080/myapp
Having different context paths like this:
http://mycompany.com/mypublicapp --> http://mycompany.lan:8080/myprivateapp
would need to rewrite urls in the generated html with something like mod_proxy_html:
/myprivateapp/home.html would need to be rewritten as /mypublicapp/home.html.
Instead of using mod_proxy_html, is it possible to have a valve that would take care of this by letting the proxy send the correct contextPath in a request header (X-Forward-ContextPath) which would override request.getContextPath(), response.sendRedirect(), etc.? Or is it a bad idea?
Proxies can already send the remote server, ip address, port to tomcat... so why not the context path?
Thanks,
Xavier
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org