jeudi 31 janvier 2019

Laravel: error "The page has expired due to inactivity" (419 unknown status)

I get the error The page has expired due to inactivity. Please refresh and try again. on a Laravel 5.6.39. In Chrome Network tab it says error login - 419 unknown status

I can reproduce the error following these steps:

  • go to login view
  • enter username and password and don't check "remember me" flag
  • wait that session expires (for test purpose I set SESSION_LIFETIME to 1 minute)
  • hit Login button and I get that error

I already read and tried the most common causes:

  • @csrf is present in the login form (it's the default authentication by Laravel)
  • the folder storage has 755
  • tried to launch php artisan cache:clear php artisan config:clear php artisan route:clear php artisan view:clear php artisan config:cache php artisan key:generate
  • I'm using the default SESSION_DRIVER=file but in production I also tried to replace it with SESSION_DRIVER=cookie with SESSION_DOMAIN=https://app.my-domain.com/

My .env file

APP_NAME='My App Name'
APP_ENV=local
APP_KEY=base64:+P6N350yBjAzw4q3oarQY/8mpJxDY7uwTTafriWrvMM=
APP_DEBUG=true
APP_LOG_LEVEL=debug
APP_URL=https://app.my-domain.com

DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=xxx
DB_USERNAME=xxx
DB_PASSWORD=xxx

BROADCAST_DRIVER=log
CACHE_DRIVER=file
SESSION_DRIVER=file
SESSION_LIFETIME=1
QUEUE_DRIVER=sync

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_DRIVER=smtp
MAIL_HOST=smtp.mailtrap.io
MAIL_PORT=2525
MAIL_USERNAME=xxx
MAIL_PASSWORD=xxx
MAIL_ENCRYPTION=null

PUSHER_APP_ID=
PUSHER_APP_KEY=
PUSHER_APP_SECRET=
PUSHER_APP_CLUSTER=mt1

ITEMS_PER_PAGE=20
BIRTH_YEAR=2018

I really have no more idea to solve this. Some helps? Thanks



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire