Best way for allowing subdomain session cookies using Tomcat
Posted
by Andrew Ingram
on Stack Overflow
See other posts from Stack Overflow
or by Andrew Ingram
Published on 2008-09-17T12:36:45Z
Indexed on
2010/05/25
7:01 UTC
Read the original article
Hit count: 536
By default tomcat will create a session cookie for the current domain.
If you are on www.example.com, your cookie will be created for www.example.com (will only work on www.example.com). Whereas for example.com it will be created for .example.com (desired behaviour, will work on any subdomain of example.com as well as example.com itself).
I've seen a few Tomcat valves which seem to intercept the creation of session cookies and create a replacement cookie with the correct .example.com domain, however none of them seem to work flawlessly and they all appear to leave the existing cookie and just create a new one. This means that two JSESSIONID cookies are being sent with each request.
I was wondering if anybody has a definitive solution to this problem.
© Stack Overflow or respective owner