Laravel 419 Error - VerifyCsrfToken issue

前端 未结 6 1150
孤独总比滥情好
孤独总比滥情好 2021-01-14 19:23

I have multiple Laravel sites hosted on the same server. With the latest site I\'ve created, the contact form refuses to submit without throwing a 419 error. I have set up t

6条回答
  •  逝去的感伤
    2021-01-14 19:42

    just found your issue on the framework repo. It is not a laravel issue, your installation is missing write permissions on the storage folder, thus laravel can't write session, logs, etc.

    You get a 419 error because you can't write to the files, thus you can't create a sessionn, thus you can't verify the csrf token.

    Quick fix: chmod -R 777 storage

    Right fix: move your installation to a folder where nginx/apache/your user can actually write. If you are using nginx/apache, move you app there and give the right permissions on the project (chown -R www-data: /path-to-project) If you are using php artisan serve, change it's permissions to your user: chown -R $(whoami) /path-to-project

    You get it, let writers write and you're good.

提交回复
热议问题