开发者

Same jsessionid for MyProject.com and param.MyProject.com

Is it possible to keep the same jsessionid on 2 differents url in the same domain?

Example :

I'm on the home page of my site (http://MyProject.com). When I click on a button, I'm redirected to "http://param.MyProject.com". At the moment, the browser doesn't send the current jsessionid and the server creates a new one but I would like to keep the same. The consequence is that when the url changes from MyProject.com to param.MyProject.com, I loose my HttpSession and I'm logged out.

I use tomcat 7 and开发者_运维问答 Chrome or Firefox.

Thanks for your answers.


It really depends on the "domain name" set for the Cookie.

A Cookie set for www.myproject.com will not work with param.myproject.com, but if the cookie is set for myproject.com, it will work for myproject.com and all sub-domains of myproject.com

You can configure the cookie domain for tomcat by modifying META-INF/context.xml as below:

<Context sessionCookiePath="/" sessionCookieDomain=".myproject.com" />
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜