K
K
Kirill Kotov2018-08-16 13:37:52
Laravel
Kirill Kotov, 2018-08-16 13:37:52

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
5b7553da3251c742830271.jpeg
LAN
5b7553f4ab891893704476.jpeg

Answer the question

In order to leave comments, you need to log in

4 answer(s)
A
Alexey Bille, 2018-08-16
@sk1llmuf

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.

V
Vopp, 2018-12-06
@Vopp

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

B
borodatych, 2019-07-12
@borodatych

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!

E
Eugene Pedya, 2021-07-29
@fpinger

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 question

Ask a Question

731 491 924 answers to any question