Amazon Load Balancer sticky sessions configuration for jsessionid in URL

tenshi picture tenshi · Feb 23, 2011 · Viewed 7.7k times · Source

I currently trying to setup Amazon Load Balancer for Tomcat workers, but I faced one problem.

I'm using sticky sessions and cookie JSESSIONID is available for most of the requests. But some requests have session information in URL, like this:

http://myserver.com/contextPath/someAction;jsessionid=BA6853C23F795BD5EEDAEA996E601BB8

And it does not work (and request is forwarded to the wrong worker).

Does AWS Load Balancer support jsessionid in the URL? If no, than maybe you know some workarounds?

With Apache + mod_proxy_balancer I can, for example, define it like this:

ProxyPassMatch /.* balancer://mycluster stickysession=JSESSIONID|jsessionid 

Answer

Shlomo Swidler picture Shlomo Swidler · Feb 27, 2011

AWS's Elastic Load Balancer does not support URL-based session stickiness.

Be sure to check that you've set the ELB's stickiness policy.

Also, ELB's stickiness doesn't actually look at the value of any cookie except for its own called "AWSELB". When you configure a cookie-based stickiness policy you're really configuring the lifetime of the stickiness to follow the lifetime of the specified cookie - but the actual server assignment is controlled by the AWSELB cookie.