Reputation: 31
page expired 419 appears when in production. I've tried to run php artisan clear:cache, php artisan config:cache, php artisan key:generate, and also change the SESSION_DOMAIN with the same domain, but the page still error
if I deactivate the CSRF middleware it doesn't have an error, but I can't go to the next page.
I can run it on local, but when I use production database in local have the same error page.
Upvotes: 3
Views: 7954
Reputation: 61
I think it is possible there are two or more issues with the 419 PAGE EXPIRED.
I was never able to get it to work by changing the CRSF token, removing it, or disabling it.
I think the actual cause has to do with permissions with where the SESSION_DRIVER data is stored.
By default the .env has SESSION_DRIVER=database. Changing database storage to file storage SESSION_DRIVER=file works if your file permissions are correct. Once you have the file permissions set correctly, change back to SESSION_DRIVER=database if you so desire.
I was using SQLite3, and the only way it worked was if the database was in location ~/laravel/stoarage/sqlite3.database
Upvotes: 6
Reputation: 71
i fixed it by removing this meta from the main blade.php template.
<meta name="csrf-token" content="{{ csrf_token() }}">
because of this warning on inertiajs page:
If you're using Laravel, be sure to omit the csrf-token meta tag from your project, as this will prevent the CSRF token from refreshing properly.
Upvotes: 5