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 no
None of the above solutions worked for me, but I found it in MOTECH project documentation here: http://docs.motechproject.org/en/latest/deployment/sticky_session_apache.html
This config works for me (on Apache 2.4.41):
(...)
Header add Set-Cookie "ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/" env=BALANCER_ROUTE_CHANGED
(...)
(...)
BalancerMember http://10.20.30.40:8080 route=backend-1 enablereuse=On
BalancerMember http://10.20.30.41:8080 route=backend-2 enablereuse=On
ProxySet lbmethod=bytraffic
ProxySet stickysession=ROUTEID
(...)
ProxyPass / balancer://mycluster/
ProxyPassReverse / balancer://mycluster/
(...)