Answer the question
In order to leave comments, you need to log in
Laravel PHP. Error 419. What to do?
The tokens are the same on the LAN, but different on the hosting, because of this, error 419.
Host
LAN
Answer the question
In order to leave comments, you need to log in
csrf token, in theory, should always be unique (at least within one session), judging by the fact that the form has "return false;" on onsubmit, I can assume that the form is sent via ajax, check if the csrf token is sent.
Is the form sent to the same site?
Or are you trying to send a form from LAN to hosting? if so, then of course it will be 419, and csrf was invented for this.
Lord! I struggled with 419 error for a long time. In general, it is not written anywhere that the cache can be the cause. Clear all kinds of cache. Helped me.
Reoptimize loader class:
php artisan optimize
Clear facade cache:
php artisan cache:clear
Clear routes cache:
php artisan route:cache
Clear view cache:
php artisan view:clear
Clear config cache:
php artisan config:cache
I'll add my contribution!
I left the project for the night, and in the morning I sent an Ajax request and got the same error.
After F5 dropped to the login page.
That is, everything is simple - the token is gone, keep this in mind!
Another reason is session lifetime. If there is an auto login, authorization is not noticeable, but the token is re-created. Therefore, it remains either to extend the session while working with forms, or switch to API with Ajax.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question