Losing JSESSIONID when using ProxyHTMLURLMap
- by Matthew Schmitt
I've setup a reverse proxy between an Apache front-end and multiple Tomcat backends. The below block of code includes the ProxyHTMLURLMap param so that the HTML can be rewritten to remove the Tomcat context path. With this setup in place, after logging into my application, an initial JSESSIONID is set properly, but when navigating to any other page, this JSESSIONID is lost and another one is set by the application.
I should mention that the initial login directs to a URL that includes the current context path (i.e. https://app.domain.com/context/home), but when navigating to another page, that context path is not present in the URL (i.e. https://app.domain.com/page2).
<Proxy balancer://happcluster>
BalancerMember ajp://happ01.h.s.com:8009 route=worker1 loadfactor=10 timeout=15 retry=5
BalancerMember ajp://happ02.h.s.com:8009 route=worker2 loadfactor=10 timeout=15 retry=5
BalancerMember ajp://happ03.h.s.com:8009 route=worker3 loadfactor=5 timeout=15 retry=5
BalancerMember ajp://happ04.h.s.com:8009 route=worker4 loadfactor=5 timeout=15 retry=5
BalancerMember ajp://happ05.h.s.com:8009 route=worker5 loadfactor=5 timeout=15 retry=5
ProxySet lbmethod=bytraffic
ProxySet stickysession=JSESSIONID
</Proxy>
ProxyPass /context balancer://happcluster/context
ProxyPass / balancer://happcluster/context/
<Location /context/>
# Rewrite HTTP headers and HTML/CSS links for everything else
ProxyPassReverse /
ProxyPassReverseCookieDomain / app.domain.com
ProxyPassReverseCookiePath / /context
ProxyHTMLURLMap /context/ /
# Be prepared to rewrite the HTML/CSS files as they come back
# from Tomcat
SetOutputFilter INFLATE;proxy-html;DEFLATE
</Location>
Has anyone ever run into a similar situation?