PHP跨域重定向会话丢失
最近我正在开发一个具有 facebook 身份验证的网站,基本上它会重定向到 facebook 页面(标头重定向),用户对其进行身份验证,然后 facebook 重定向回该网站。在我的本地服务器上一切都很好,但是当我上传到实际服务器时,事情就搞砸了。当 Facebook 重定向回该站点时,会话信息(一些登录详细信息)会丢失。
我搜索了一下,在我看来这是一个常见问题,但我尝试了所有建议的解决方案(例如在标题后添加 session_write_close() 或 exit() ,传递session_id)它们都不起作用。我正在使用 Zend,因此“忘记 session_start”不是问题。
有人说它有一些东西可以处理 https 差异,有人说这是跨域的事情并且无法修复,我现在有点迷失了,任何有建议的人都非常感激。
Recently I'm working on a site that has a facebook authentication in it, basically it redirects to the facebook page (a header redirect) and the user authenticates it and then facebook redirects back to the site. Everything is fine on my local server but when I upload to the actual server things screw up. When facebook redirects back to the site the session information (some login details) is lost.
I searched and seemed to me that this is a common problem, yet I tried all the proposed solutions (like adding session_write_close() or exit() after the header, passing the session_id) none of them works. I'm using Zend so the "forgetting session_start" is not the issue.
Some say it has something to deal with the https difference, some say it's a cross-domain thing and it's not fixable, I'm kind of lost right now, anyone who has suggestions is greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试在 init() 中设置此标题,
这是 IE 的常见问题,这在某些情况下可以解决该问题。
Try setting this heading in your init()
It's a common problem with IE and this will fix it in some cases.
谢谢大家,我通过为网站设置 SSL 解决了这个问题。这是因为http & https 问题。
Thanks guys, I solved it by setting up SSL for the site. It is because of the http & https problem.