You submit a form in Laravel, and instead of a success message you get a grey screen: 419 | PAGE EXPIRED . No stack trace, no hint. Just a number.
Here is the good news: the 419 error has one cause, and one cause only. Laravel's CSRF middleware compared the token in your request with the token in your session, and they did not match β or the session was not there at all. Fix the token or the session, and the error is gone.
The fix that solves most cases
Every form that sends POST, PUT, PATCH or DELETE needs a CSRF token. In Blade, one directive adds it:
<form method="POST" action="/posts"> @csrf <input type="text" name="title"> <button type="submit">Save</button> </form>
Enter fullscreen mode
Exit fullscreen mode
@csrf renders a hidden _token input. Forget it, and Laravel rejects the request with a 419 before your controller ever runs.β¦