Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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., but when navigating to another page, that context path is not present in the URL (i.e.

<Proxy balancer://happcluster>
BalancerMember ajp:// route=worker1 loadfactor=10 timeout=15 retry=5
BalancerMember ajp:// route=worker2 loadfactor=10 timeout=15 retry=5
BalancerMember ajp:// route=worker3 loadfactor=5 timeout=15 retry=5
BalancerMember ajp:// route=worker4 loadfactor=5 timeout=15 retry=5
BalancerMember ajp:// 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 /
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

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

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.