Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

ramonpego's avatar

Laravel shared session, does not working only for login

I am using shared session with some subdomains of mine, were working but now stopped and I do not know why. They use the same key and the like in env.

APP_KEY=base64:d+JhMsQVeouOI82JPiQtIvBUjizigUxD75uCVt747ns=

SESSION_DRIVER=database
SESSION_LIFETIME=120
SESSION_DOMAIN='.global.test'
SESSION_COOKIE=global_session

SESSION_CONNECTION=session_storage
SESSION_DB_HOST=localhost
SESSION_DB=ged_global
SESSION_DB_USER=digitaliza
SESSION_DB_PASSWORD=


//my local variables

All subdomains and main domain using this exact same values

if i login on any one, i have to log again on every system, but if i logout i log out for everyone

I am looking at my database all of them using the same row in the session table.

0 likes
3 replies
jlrdw's avatar

You could probably lookup multi tenant in laravel and get some good ideas.

ramonpego's avatar

yes, but I wanted it to work again, It was solving my problem and it stopped working, and I have no idea why

ramonpego's avatar
ramonpego
OP
Best Answer
Level 4

What stopped the session from being shared was the implementation of the 404labfr/laravel-impersonate package. So between it and the session sharing I decided to run out of the package since the session directly impacts the user, and this package is only used internally for employees. I will open an issue about this impact in the sessions as it is a very interesting package.

Please or to participate in this conversation.