Skip to content
RT Softs

Laravel 419 Page Expired: CSRF, sessions and the cookie domain

A 419 is Laravel saying the CSRF token in the form does not match the session. The cause is almost always the session, not the token.

A Admin
March 16, 2026 3 min read Updated Nov 19, 2026

Laravel returns 419 when VerifyCsrfToken cannot match the submitted _token with the token stored in the session. The token itself is rarely broken — the session behind it is.

Check that the form actually sends a token

Every POST form needs @csrf, and every JavaScript request needs the X-CSRF-TOKEN header or the X-XSRF-TOKEN cookie. A form built with raw HTML is the most common culprit, especially inside a Blade component that was copied from a GET form.

  • POST, PUT, PATCH and DELETE all need a token; GET does not
  • Check the rendered page source for a hidden _token input
  • For fetch/axios, send X-CSRF-TOKEN from the meta tag

Session driver and storage permissions

If SESSION_DRIVER is file, Laravel writes to storage/framework/sessions. A deploy that runs as a different user, or a fresh clone without that directory, produces a new empty session on every request — and therefore a new token. The token in the form is then always one request behind.

Serving the site on www.example.com while SESSION_DOMAIN is example.com (or the reverse) means the browser never sends the session cookie back. The session appears empty, the token rotates, and the form fails. Set SESSION_DOMAIN to the exact host you serve, or to .example.com if you genuinely need both.

The session expired, and that is correct behaviour

A form left open longer than SESSION_LIFETIME (120 minutes by default) will fail with 419. That is the security feature working. For long editor sessions, either extend the lifetime or refresh the token periodically with a small AJAX endpoint.

Proxy and load-balancer traps

Behind a load balancer without sticky sessions, two requests can land on different servers with different session stores. If you must run multiple app servers, move sessions to the database, Redis or cookies. Also make sure APP_URL and the trusted proxies are configured, or Laravel will generate http:// URLs inside an https:// page.

Frequently asked questions

Should I just disable CSRF for that route?

No. Excluding a route from CSRF protection removes a real defence, and it hides the session bug rather than fixing it. The only routes that should be excluded are stateless webhooks that verify their own signatures.

Why does it only fail in production?

Production usually differs in three places: HTTPS and therefore cookie domain, a different session driver, and cached config. Compare SESSION_DRIVER, SESSION_DOMAIN and SESSION_SECURE_COOKIE between environments first.

Does clearing the browser cookies help?

It proves the theory. If clearing cookies and reloading fixes it once, the server is issuing a new session on every request — look at storage permissions or the cookie domain.

More on this topic: Laravel articles.

A

Admin

Related articles