Sharing HTTP Session between subdomains « Intelligrape Groovy & Grails Blogs

Sharing HTTP Session between subdomains

Posted by

Recently, I had a usecase to share same http session between different subdomains. The idea was that if a user is logged in on “somedomain.com“, he need not to login again to go to subdomain.somedomain.com. The same http session should be usable. I started off on the wrong foot by looking into the SpringSecurity plugin, which I had been using. But, later on, I found that this is to be done by configuring the Tomcat. The solution is to configure tomcat to recongnize session cookies from the subdomains. So all it takes is to modify element tomcat/conf/Context.xml to:

 <Context sessionCookiePath="/" sessionCookieDomain=".yourdomain.com">

and you are good to go. The solution works for Tomcat version 6.0.27 and above.

Cheers,
Imran Mir
imran[at]intelligrape[dot]com

This entry was posted on March 21st, 2012 at 11:01 am and is filed under Grails, System . You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a Reply