Search code examples
javasessionamazon-ec2tomcat6jsessionid

How to generate custom JSESSIONID, based on some hash of user's data in order to replicate session


Is it possible to override Tomcat's embedded generator of JSESSIONID, to be able to create custom values of this cookie, based on user's login?

Why do I need this: I have a load balancer with "sticky sessions", configured to route requests with the same JSESSIONID to the same server, and I want to prevent situation, when same user can start two different sessions on different servers.

P.S: all this is about Amazon EC2


Solution

  • There is a better way to do this: See the tomcat manual on session replication in cluster