简体   繁体   中英

Why are sessions for my two Laravel sites conflicting?

I have a Laravel 4.2 application deployed on a server on our intranet called "Dashboard". It can be accessed via the URL http://dashboard.mydomain.local/ and uses the "native" driver for session storage.

I am in the process of reconfiguring the application to run in Docker containers. The new site can be accessed via http://dbdock.mydomain.local/ and is running on a different server. The new site uses "redis" for sesson storage.

Here's the problem:

If I'm signed in to one site and then sign into the other, then I get signed out of the other.

Here's what I've tried:

  • I updated the application URL in the config/app.php file.
  • I changed the the encryption key.
  • I changed the session cookie name in config/session.php

It seems to me that the sessions should be kept strictly separated in this case because a) the session store is different (filesystem vs. redis); b) the session store is on different servers; c) the URLs for the two sites are different; and d) the session cookie names are different.

I can't understand how these two sites are conflicting with each other. Can anyone explain to me what's going on in this case?

Edit I should mention that these two applications are using the same database server for the user database. This is for the purposes of transitioning away from the original server (which is going to be retired in the near future).

I know this is a bit old but I had the same problem with two Laravel projects and when I changed the session cookie name in config/session.php for one of them, the problem solved.

I think you should delete your browser cookies.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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