I'm using apache httpd with ProxyPass and DNS RR and sticky Java sessions for Tomcat.
It's not working.
My apache config is:
ProxyPass "/" "balancer://mycluster/" stickysession=JSESSIONID|jsessionid scolonpathdelim=On <Proxy balancer://mycluster> BalancerMember http://stest:8080/ </Proxy> <Location "/balancer-manager"> SetHandler balancer-manager Require host localhost </Location>
When I do an
nslookup stest on the httpd host I have 5 hosts that come back:
root@sproxy:/app# nslookup stest Server: 127.0.0.11 Address: 127.0.0.11#53 Non-authoritative answer: Name: stest Address: 10.0.0.7 Name: stest Address: 10.0.0.6 Name: stest Address: 10.0.0.8 Name: stest Address: 10.0.0.2 Name: stest Address: 10.0.0.5
Thus, my httpd server should route to one of these IP addresses until a
JSESSIONID cookie is set and then it should be sticky for that IP.
The problem is, this does not work. When I do:
while true; do curl -b /tmp/cj.txt -c /tmp/cj.txt -w '\n' localhost/test-session-servlet/json ; done
I get my servlet output, which includes the Tomcat host that I hit and the session id.
I would expect this to only hit one server, since the cookie gets set in
/tmp/cj.txt and is passed to every request. I get the same output with the above command as I do with:
while true; do curl -w '\n' localhost/test-session-servlet/json ; done
In essence, both curl commands send to different servers as if the sticky sessions are not enabled properly, but the first should not do this.
What am I doing wrong here?