简体   繁体   English

几分钟后,Laravel自动退出

[英]Laravel automatically Logout after few minutes

Two clones of my Laravel app, run on two servers and they are connected to one database server. 我的Laravel应用程序的两个克隆,在两台服务器上运行,它们连接到一个数据库服务器。 The app is accessed via a load balancer. 该应用程序通过负载均衡器访问。

However, the problem is that when the system is access via load balancer, the user is automatically logged out after 2-3 minutes. 但问题是,当系统通过负载均衡器访问时,用户会在2-3分钟后自动注销。

This does not happen when the system is access through the direct IP of one of the servers. 当系统通过其中一个服务器的直接IP访问时, 不会发生这种情况

The Session driver is set to Database. 会话驱动程序设置为数据库。

So, what's the problem here ? 那么,这里的问题是什么? I'm not sure what piece of code should I put here as your aid. 我不确定我应该把这段代码放在这里作为你的帮助。 I only use .env file to set configurations. 我只使用.env文件来设置配置。

BROADCAST_DRIVER=redis
CACHE_DRIVER=redis
SESSION_DRIVER=database
QUEUE_DRIVER=sync

Thanks! 谢谢!

Finally I found the error. 最后我发现了错误。 It was the App Key of the Laravel app. 它是Laravel应用程序的App Key。 One Server's Laravel app key has been changed by mistake during the migration. 迁移期间,One Server的Laravel应用密钥已被错误更改。 That's the bug that causes automatic sign out and token mismatch error. 这是导致自动注销和令牌不匹配错误的错误。

So, if anyone one setting up this kind of Server setup with Laravel app, make sure all the App Keys are same. 因此,如果有人使用Laravel应用程序设置此类服务器设置,请确保所有应用程序密钥都相同。

Hope this helps! 希望这可以帮助!

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

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