简体   繁体   English

iframe 中的 laravel 应用程序不断刷新 session

[英]laravel app in iframe keeps refreshing the session

Our website https://www.diamir.de is build with laravel.我们的网站https://www.diamir.de使用 laravel 构建。 when we try to load the site in an iframe on another domain, the session is regenerated with every request.当我们尝试在另一个域上的 iframe 中加载站点时,每个请求都会重新生成 session。 the session cookie is send to the browser. session cookie 被发送到浏览器。 but it seems laravel is not able to read it on the next request and therefore regenerates the session.但似乎 laravel 无法在下一个请求中读取它,因此重新生成 session。

how can we enable sessions when the site is loaded in an iframe on another domain?当站点加载到另一个域的 iframe 中时,我们如何启用会话? is this even possible with the security settings in modern browsers?这甚至可以通过现代浏览器中的安全设置实现吗?

thanks.谢谢。

iFrames are largely locked down windows to view other content inside your website. iFrames 在很大程度上被锁定 windows 以查看您网站内的其他内容。 They were a useful way of hacking things into sites, but have been replaced in a lot of scenarios.它们是一种将东西侵入网站的有用方法,但在很多情况下已被取代。

For your particular scenario, showing the site fully on another domain, there are other, better ways to reference the same site from multiple domains.对于您的特定场景,将站点完全显示在另一个域上,还有其他更好的方法可以从多个域中引用同一个站点。

Personally, I'd redirect in most scenarios, all where an iFrame would work.就个人而言,我会在大多数情况下重定向,所有情况下 iFrame 都可以工作。 This results in a user going to any secondary domain, and being redirected to the primary domain.这会导致用户转到任何辅助域,并被重定向到主域。 Usually done with a 301 permanent redirect.通常使用301 permanent重定向来完成。

However, the one occasion where I need the site sitting on multiple domains is when the site is themed on other domains.但是,我需要该站点位于多个域上的一种情况是该站点以其他域为主题。 In a lot of these cases, it's preferable to fork the site and make changes as needed, but in those that need the same code base and just a theme over the top, I'd simply have the server (Apache, NGINX, or any other server) listen to multiple domains all serving the same site .在很多情况下,最好分叉站点并根据需要进行更改,但在那些需要相同代码库并且只是顶部主题的情况下,我只需拥有服务器(Apache、NGINX 或任何其他服务器)侦听所有服务于同一站点的多个域

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

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