I've got a Laravel 5.7 app that is working locally. For instance, when running locally I'll get flash messages about failed validation and it shows fine in the blade view:
I do have the
@csrf helper in my blade form.
When I deploy and submit the form on production I get a 419 error: "Sorry, your session has expired. Please refresh and try again". Redirects are not working for social login with google or linkedin in production, though they're working locally.
I am using Laravel Forge for production and database tables for session and cache. So my .env file for production is:
BROADCAST_DRIVER=log CACHE_DRIVER=database SESSION_DRIVER=database QUEUE_DRIVER=sync
I have tried changing the
APP_KEY and deleting all the contents of the "sessions" table as well but the 419 error persists on production.
Then my deployment script for Laravel Forge is:
cd /home/forge/employbl.com git reset --hard origin/master git pull origin master composer install --no-ansi --no-dev --no-interaction --no-progress --no-scripts --optimize-autoloader echo "" | sudo -S service php7.2-fpm reload rm -rf node_modules composer dump-autoload php artisan config:clear php artisan view:clear php artisan responsecache:clear php artisan config:cache php artisan migrate --force php artisan sitemap:generate
How can I clear the sessions so I don't get the 419 "your session has expired" and the form works on the production server?