I am using apache web server as a load balancer for two tomcat instances behind apache. When the first request goes to node A and second request from the same client goes to node B, i cant access session variables within node A. It's obvious. I surfed in the internet and found that enabling sticky sessions would help. But all the tutorials for enabling the sticky sessions in apache look confusing. Is there any simple step-by-step tutorial for this? Please help.
Code fragment from comment:
ProxyPass /balancer-manager !
ProxyPass /balancer://mycluster/ stickysession=JSESSIONID
ProxyPassReverse /balancer://mycluster/
<Proxy balancer://mycluster>;
BalancerMember ajp://localhost:9001/ route=NodeA1000 retry=10
BalancerMember ajp://localhost:9002/ route=NodeB1000 retry=10
</Proxy>
Best Answer
This worked for me...
Instead of using stickysession=JSESSIONID in ProxyPass directive it has to be set within balancer configuration using ProxySet stickysession=JSESSIONID:
It was not working for me when I was using it in ProxyPass as shown below:
This should be added to apache docs, because it's such a pain to solve.