简体   繁体   English

Laravel session 在 Z763F7F1AEC350CD1A46238D1D5C3C2 中的 iframe 中打开站点时被杀死

[英]Laravel session killed when opening site in iframe in Firefox

This issue only seems to be affecting Firefox, and then only some users (with no obvious version / security setting differences).此问题似乎仅影响 Firefox,然后仅影响部分用户(没有明显的版本/安全设置差异)。 We are getting session loss in our Laravel app.我们的 Laravel 应用程序中出现 session 损失。

We have a payment integration that uses the iframed Opayo server integration.我们有一个使用 iframed Opayo 服务器集成的支付集成。 This opens up the payment form in an iframe in the Laravel app.这将在 Laravel 应用程序的 iframe 中打开付款表单。 Payment details are provided, and the payment is successful - including hitting an Opayo webhook to confirm the transaction.提供了付款详细信息,并且付款成功 - 包括点击 Opayo webhook 以确认交易。

The webhook returns a redirect url, that Opayo uses to redirect the user (in the iframe naturally). webhook 返回一个重定向 url,Opayo 使用它来重定向用户(在 iframe 自然中)。 This redirect url is simply a url on the same site as the app (ie the iframe parent).此重定向 url 只是一个 url 与应用程序(即 iframe 父级)在同一站点上。

At the point that the iframe loads the redirect url, the site session is immediately killed.在 iframe 加载重定向 url 时,站点 session 立即被杀死。 Originally, the page at the url broke out of the iframe (set window.top.location), and also did some ajax calls - I removed both these actions, to confirm they weren't somehow responsible for the session getting nuked. Originally, the page at the url broke out of the iframe (set window.top.location), and also did some ajax calls - I removed both these actions, to confirm they weren't somehow responsible for the session getting nuked.

Site is served over https with a valid certificate.具有有效证书的站点通过 https 提供服务。 Session cookie is set to secure, http only and same site 'lax' Session cookie 设置为安全,仅 http 和同一站点“宽松”

What could be causing this behaviour?什么可能导致这种行为?

This is because the iframe is not exactly your page running on your system.这是因为 iframe 并不完全是您系统上运行的页面。 So, if the iframe is not on your system, it will not have access to the cookies that are in your application.因此,如果 iframe 不在您的系统上,它将无法访问您应用程序中的 cookies。

If the iframe is from your application, I advise you to use query params in the url of the iframe to pass such necessary information within the iframe.如果 iframe 来自您的应用程序,我建议您使用 iframe 的 url 中的查询参数在 iframe 中传递此类必要信息Something like:就像是:

<iframe src="https://www.foo.bar?value=1&value_2=2"></iframe>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM