issue with session across subdomain only for googl

2019-09-08 06:25发布

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

3条回答
▲ chillily
2楼-- · 2019-09-08 06:56

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.

查看更多
Anthone
3楼-- · 2019-09-08 07:05

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

查看更多
爷的心禁止访问
4楼-- · 2019-09-08 07:08

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.

查看更多
登录 后发表回答