Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

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

Has anyone ever run into a similar situation?

share|improve this question
add comment

1 Answer

So I figured out what the issue was. I had to reverse the following param

ProxyPassReverseCookiePath /context /

Now I'm not losing JSESSIONID.

share|improve this answer
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.