仅适用于 google chrome 的跨子域会话问题

发布于 2024-12-11 19:08:50 字数 260 浏览 0 评论 0原文

我遇到了一个奇怪的问题,仅适用于谷歌浏览器的跨子域会话。 我有两个子域 a.mydomain.com & b.mydomain.com。 如果我首先在浏览器上打开 a.mydomain.com然后打开 b.mydomain.com &从那里登录然后我无法在 a.mydomain.com 中获得会话。但如果我先从 b.mydomain.co 登录 &然后打开 a.mydomain.com 我在 a.mydomain.com 中获取会话。

我无法解决这个问题。请帮忙

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

空城缀染半城烟沙 2024-12-18 19:08:50

愚蠢的我,找到了答案,所以喜欢分享它,

我仅将 session.cookie_domain 用于 b.mydomain.com &不适用于 a.mydomain.com

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

濫情▎り 2024-12-18 19:08:50

查看浏览器中的会话 cookie。它们的域设置是什么?可能您的网站有不同的 cookie 设置。其中 a 站点正在设置 .mydomain.com cookie,b 站点正在设置 b.mydomain.com,防止 cookie 出现在网站 a 上。

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.

做个ˇ局外人 2024-12-18 19:08:50

仅当在上一级域中设置 Cookie 时,Cookie 才会被继承。在 example.com 上设置 cookie 会将其继承到 www.example.com、foo.example.com 等。
在 www.example.com 上设置 cookie 不会向 foo.example.com 显示 cookie。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文