我如何维持与子域和 https 的会话
我有一个与子域和 https 请求相关的问题。
我正在尝试从http路由到https,其中我的http地址是subdomain.domain.com,https地址是domain.com/subdomain。但问题是,当我从 http 切换到 https 时,我丢失了会话变量。
我如何在 http 和 https 请求中保留我的会话变量。
谢谢。
I have a problem related to subdomain and https request.
I am trying to route from http to https where my http address is subdomain.domain.com and https address is domain.com/subdomain. But the problem is when i switched from http to https i loose my session variables.
How can i persist my session variables in both http and https requests.
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
会话可能由 cookie 跟踪。
Cookie 有一个与其关联的域,在本例中为“subdomain.domain.com”。对于不同的域,即使是父域,网络浏览器也不会提供cookie。
我认为有一些方法可以使 cookie 对给定域下的所有子域有效,但您必须查看您所使用的软件的文档。
有关更多信息,我们确实需要有关您使用什么软件来保持此会话的更多详细信息。标准 PHP 会话?或者其他什么?
The session is probably tracked by a cookie.
Cookies have a domain associated with them, in this case this would be "subdomain.domain.com". For a different domain, even if it is the parent domain, the cookie will not be provided by the web browser.
I think there are ways to make a cookie valid for all subdomains under a given domain, but you have to look into the documentation of the software you are using for that.
For any more information, we really need more detail about what software you are using to keep this session. Standard PHP sessions? Or something else?