EncryptCookies middleware 419 page expired error
I have a custom SimplePage with a form that is throwing a 419 error every time I try to submit it. I have tried also to create a filament-form component with the exact same result.
After some digging I've noticed the issue is related with the \Illuminate\Cookie\Middleware\EncryptCookies middleware and the problem goes away as soon as I remove the middleware from the panel or my custom route. Any ideas why?
Solution:Jump to solution
Ok so looks like I've found the solution. I had to modify the AdminPanelProvider and change:
use Illuminate\Cookie\Middleware\EncryptCookies;
to:...
4 Replies
Solution
Ok so looks like I've found the solution. I had to modify the AdminPanelProvider and change:
use Illuminate\Cookie\Middleware\EncryptCookies;
to:
use App\Http\Middleware\EncryptCookies;
Not sure why as the App one extends from the Illuminate class. Will leave it here in case it helps anyone.
You saved the day. Thanks
it doesn't work for me, still have 419 | PAGE EXPIRED
Your custom form may need the csrf directive to inject hidden csrf token
add
within your form tag
See reference from this docs: https://laravel.com/docs/10.x/csrf
Laravel - The PHP Framework For Web Artisans
Laravel is a PHP web application framework with expressive, elegant syntax. We’ve already laid the foundation — freeing you to create without sweating the small things.