People searching “Laravel database session Vue” stay on the file driver and then login sticks on one server and 419s on the other. The cookie is fine. The session file is on the other disk. The Sanctum guide is the cookie. This page is the driver.
TL;DR
- File sessions break when two servers handle the next request.
- database sessions follow the user.
- Do not use the file driver on a platform that runs more than one machine, or that does not keep local disk.
- Do not put session rows in the same backup story as “we can delete the sessions table to clean up” without knowing you will log everyone out.
The fix#
php artisan session:table
php artisan migrateSESSION_DRIVER=databaseInertia visits then read the session from the database, including the CSRF token and the logged-in user. One database, many app servers.
What to avoid#
Gotcha
Do not use the file driver on a platform that runs more than one machine, or that does not keep local disk. Do not put session rows in the same backup story as “we can delete the sessions table to clean up” without knowing you will log everyone out. That part is fine on purpose. Doing it in the middle of the day is the outage.
FAQ#
How do I store sessions in the database?
File sessions break when two servers handle the next request. database sessions follow the user.
What goes wrong with Laravel database session Vue?
Many developers stay on the file driver and then login sticks on one server and 419s on the other. Do not use the file driver on a platform that runs more than one machine, or that does not keep local disk.



