AWS Load Balancer Laravel 419 page expired error
Recently I encountered an issue that is when I created a load balancer for a project and the project I created with Laravel Framework. I found a problem: when I am trying to submit the form it shows me:
419 | PAGE EXPIRED
Laravel by default keeps the session in the file, The reason I was getting the error. As I don’t have any sync enabled for my instances so it was failing to get the file. The easiest fix is to set the session_driver=file
to session_driver=database
in .env
file and then run
php artisan session:table
php artisan migrate
Reference: Laravel 8.x
For the newer version of Laravel, it’s a bit different to create a session table:
php artisan make:session-table
php artisan migrate
Reference: Laravel 11.x
Once all of these are done you have to do this clear and cache the configuration
php artisan config:cache
Written on October 19, 2024