issue with session across subdomain only for google chrome

纵然是瞬间 提交于 2019-12-13 05:28:15

问题


I've faced a strange issue with session across subdomain only for google chrome. I have two subdomain a.mydomain.com & b.mydomain.com. if I open a.mydomain.com first on browser & then open b.mydomain.com & login from there then I'm not getting the session in a.mydomain.com. But if I login first from b.mydomain.co & then open a.mydomain.com I'm getting the session in a.mydomain.com.

I'm unable to solve this. Please help


回答1:


Look at the session cookies in your browser. What are the domain settings on them? Possibly your sites have different cookie settings. where the a site is setting a .mydomain.com cookie, and the b site is setting b.mydomain.com, prevent the cookie from appear on site a.




回答2:


silly me, found the answer so liked to share it

I used session.cookie_domain only for b.mydomain.com & not for a.mydomain.com




回答3:


Cookies will only be inherited when setting them on the domain one level above. Setting the cookie on example.com will inherit it to www.example.com, foo.example.com, etc. Setting a cookie on www.example.com will not show the cookie to foo.example.com.



来源:https://stackoverflow.com/questions/7880305/issue-with-session-across-subdomain-only-for-google-chrome

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!