Error fix

419 Page Expired in Laravel: Cause and Fix

Laravel answers 419 when the CSRF token of a request does not match the token in the session. Check the form, the AJAX headers, the session lifetime and the session cookie.

The error message

419 | Page Expired

Possible causes: why does "419 | Page Expired" appear?

  • Form without @csrf. Every form that sends POST, PUT, PATCH or DELETE to a web route needs a hidden _token field, which the Blade directive @csrf creates. Without it the ValidateCsrfToken middleware rejects the request, and Laravel turns the TokenMismatchException into HTTP status 419.
  • Session expired. The token is stored in the session. Its lifetime is set in config/session.php (lifetime, environment variable SESSION_LIFETIME, default 120 minutes of inactivity). If the session expired before the form was sent, the token no longer matches, for example when a form stayed open longer than that.
  • Page loaded before a login. The token changes every time the session is regenerated. The Laravel starter kits and Laravel Fortify regenerate the session ID during authentication to prevent session fixation. A page loaded before that, for example the login page in a second tab, still sends the old token.
  • AJAX request without a token header. For JavaScript requests to web routes the middleware also accepts the token in the X-CSRF-TOKEN header (usually read from a meta tag) or in the X-XSRF-TOKEN header (from the XSRF-TOKEN cookie). If neither is sent, the result is 419.
  • Session cookie does not arrive. SESSION_DOMAIN does not match the domain in the browser, or SESSION_SECURE_COOKIE is true but the page is served over plain HTTP. Without the session cookie there is no session token to compare.

How do you fix it?

  1. Add @csrf to every form that sends POST, PUT, PATCH or DELETE.
  2. For AJAX, put the token in a meta tag and send it as X-CSRF-TOKEN header.
  3. Set lifetime in config/session.php to fit the page and check that SESSION_DOMAIN and SESSION_SECURE_COOKIE match the domain and the protocol. If you use config:cache, rebuild the cache after changing .env.
  4. In the browser developer tools (Network tab), check whether the failing POST sends the session cookie and a _token field or an X-CSRF-TOKEN header.
  5. Routes for external services such as payment webhooks belong outside the web middleware group, or you exclude them in bootstrap/app.php with validateCsrfTokens(except: [...]).

Form

<form method="POST" action="/profile">
    @csrf
    ...
</form>

Sources

Sources checked on 2026-12-03. German version: 419 Page Expired in Laravel: Ursache und Lösung

Related errors

Still getting the error?

Your Laravel project gets checked, and you learn honestly what causes it. Free 30-minute call.