Laravel Auth Session logs me out after a period of time Users in my application are getting logged out after a period of time although i have set the environment variable SESSION_LIFETIME = 525600
There are 100+ concurrent users in the application
The SESSION_DRIVER is set to file, i have read that changing to database and creating the php artisan session:table migration will make it work.
Shall i give it a try? Or is this based on another problem i might be having?
**Edit
Locally this does not happen.
@stelikas
How long is "after a period of time"? It might give some idea as to what is wrong.
There is not a standard time that logs me out.
@stelikas
I would try setting SESSION_LIFETIME = 1 to see if changes any behavior.
Are you using SESSION_DRIVER = file locally?
Locally using SESSION_LIFETIME = 1 logs me out after 1 minute, i have changed to database now, but i was using file.
@stelikas
I have never used FILE before, but I suspect it is something else in your production and not DATABASE vs FILE. No harm trying though.
I'm using the standard Login Auth Route so i don't think the login function is the problem, also it's a single page application so it's also not a middleware problem which i might have not seen. It is weird that this happens in production but not locally. I read that using FILE in production is wrong, i will give DATABASE a try.
@stelikas
Yea, file is not necessarily race safe, although I have not examined that part of Laravel's code before.
So changing the SESSION_DRIVER = database and using php artisan session:table fixed the issue and now everything works as expected.
Please sign in or create an account to participate in this conversation.