tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sanket Paranjape <sanket.paranjape.mailingl...@gmail.com>
Subject Re: Session Replication across common base domain
Date Mon, 06 Jan 2014 05:53:59 GMT
Hi Guys,

Any solution for this??

On 03-01-2014 02:31 PM, Sanket Paranjape wrote:
> Hi,
>
> I am using Tomcat 7.0.47 on windows 7 with JDK 1.7.
>
> I want to achieve session replications on multiple subdomains. If I 
> have a domain as xyz.example.com and abc.example.com, then I would 
> like to store session cookie on "example.com" and hence then I would 
> be able to access same session on both domains. By default session 
> cookie is set on whole domain, if I access xyz.example.com then 
> session cookie will be set on this domain.
>
> I went through the documentation for Tomcat 7 and found that in 
> <Context> element type I can add attribute like "sessionCookieDomain". 
> I can easily set this attribute to base domain like ".example.com" and 
> this works like charm.
>
> But my requirement is slightly different. I have single tomcat serving 
> multiple domains. They all different base domains as well. So 
> hardcoding would not help me out here.
>
> So I tried following.
>
> In docs I found this link, 
> http://tomcat.apache.org/tomcat-7.0-doc/config/context.html. It says 
> that className attribute can be set for context.
> So I wrote my own class MyStandardContext which extends 
> org.apache.catalina.core.StandardContext. I overridden public String 
> getSessionCookieDomain() method. I want to return base domain of the 
> URL from this domain so that tomcat will set cookie on this domain. 
> But to my surprise I do not have access to Request URI. If I could get 
> access to this URI somehow then I would be able to extract base 
> domain. It is not possible. is it?
>
> I also tried adding multiple hosts in conf/server.xml under <Engine>. 
> This loads context multiple times, which I do not wish.
>
> My question is there any way I can get access to request URI in 
> MyStandardContext? Or is there any configuration which forces tomcat 
> to set cookie on base domain instead full domain?


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message