A laravel 419 page expired error is Laravel telling you one thing, and only one thing: the request that just arrived did not prove it came from your own application. It is not a login problem, it is not a database problem, and it is usually not a bug in Laravel. It is a CSRF check failing — a missing token, a stale token, a session that no longer exists, or a cookie that never arrived.
That sounds simple, and the first fix usually is. The frustration starts when you add @csrf and the error stays. This guide works through the seven real causes in diagnostic order, using Laravel 13’s current behaviour where it differs from older versions.
Verified against the official Laravel 13.x documentation on 29 October 2026; legacy Laravel 11/12 syntax is flagged wherever it differs.
What a 419 actually means in Laravel 13
First, 419 is not a standard HTTP status code. It is Laravel’s own code for a failed forgery check: a malicious site tricks a logged-in user’s browser into submitting a request to your app without the user visiting your form. Laravel stops that by requiring every state-changing request to carry a secret value only your own pages can know — the CSRF token, stored in the user’s session.
In Laravel 13, the PreventRequestForgery middleware (in the web middleware group by default) checks requests in two layers. First it looks at the browser’s Sec-Fetch-Site header, which modern browsers set automatically to say whether a request came from the same origin, the same site, or a cross-site source. If that header says same-origin, the request is allowed immediately, without token verification. If the origin check does not pass — an older browser, or a connection not served over HTTPS, since the header is only sent over secure connections — the middleware falls back to token validation. A 419 therefore means both layers failed.
Note one consequence: if you switch to origin-only mode with preventRequestForgery(originOnly: true), failed checks return a 403 instead of a 419.
Diagnose it in 60 seconds
Before you change any code, answer these four questions in order. They eliminate most 419s without touching configuration:
- Does the failing form contain
@csrf? View the page source in the browser and search for_token. If it is not there, you have found it — skip to cause 1. - Does a fresh page work? Reload the form page, then submit immediately. If that works, the old page’s session or token had expired — cause 2.
- Is it only JavaScript requests? If Blade forms submit fine but fetch or Axios calls return 419, the token is not reaching the request headers — cause 3.
- Does it work locally but fail in production? That gap almost always means session or cookie configuration differs between environments — causes 4 and 5.
1. The form is missing its CSRF token
This is still the most common cause, and it hides in plain sight: hand-written forms, forms copied from a static HTML prototype, forms rendered by a component that forgot the directive, and forms built with JavaScript. Laravel’s docs are blunt about it — anytime you define a POST, PUT, PATCH, or DELETE form, include a hidden CSRF _token field.
<form method="POST" action="/profile">
@csrf
<!-- Equivalent to... -->
<input type="hidden" name="_token" value="{{ csrf_token() }}" />
</form>
The @csrf directive generates that hidden input for you. Two traps catch people here. First, method spoofing does not exempt you: a form that posts with @method('PUT') or @method('DELETE') still submits as a POST under the hood, so it still needs @csrf. Second, if JavaScript intercepts the submit and rebuilds the payload from scratch, the hidden input can be dropped silently — check the Network tab to confirm the submitted form data contains _token.
Confirm it: view page source, find _token, and confirm the same value appears in the failed request’s payload in DevTools.
2. The session expired, or was regenerated, before submit
A CSRF token is only valid while its session is alive. Laravel generates a token for each active user session, and the token changes each time the session is regenerated. So a user who opens a long form, walks away, and submits an hour later is submitting a token for a session that no longer exists — and Laravel correctly rejects it.
The same thing happens after login: Laravel regenerates the session ID during authentication to prevent session fixation, so a login page opened in one tab and submitted after logging in through another carries a stale token.
The fix for users is simple: refresh the page and submit again — a fresh page carries a fresh token for the current session. For developers, check the session lifetime in config/session.php and SESSION_LIFETIME: the stock config ships with a 120-minute lifetime, and raising it is legitimate for genuinely long forms, but it is a trade-off — a longer lifetime means a stolen session cookie stays useful longer. For long forms, prefer a friendly custom 419 page (see below) over a bare “Page Expired” screen.
Confirm it: reload the form and submit immediately. If it works, the cause was expiry or regeneration, not your form markup.
3. JavaScript requests are not sending the token
Blade forms are the easy case. The moment you move to fetch, Axios, or jQuery, you own the token delivery — and this is where most “it works in the form but not in the app” 419s live. Laravel checks for the token in three places: the _token POST parameter, the X-CSRF-TOKEN request header, and the X-XSRF-TOKEN header. Pick one and send it on every state-changing request.
The documented pattern is a meta tag in your layout plus a header on each request:
<meta name="csrf-token" content="{{ csrf_token() }}">
fetch('/posts', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').content
},
body: JSON.stringify({ title: 'My new post' })
});
For jQuery, the same idea is a global setup:
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
Axios is the exception: on same-origin requests it usually needs no manual header, because Laravel sends the token in an encrypted XSRF-TOKEN cookie with every response, and Axios automatically reads that cookie and sends it as X-XSRF-TOKEN. If Axios calls 419 while fetch calls work, check whether a custom Axios instance, a different-origin base URL, or a stripped cookie broke that automatic path. Note the cookie value is encrypted: if you read it manually, URL-decode it before sending it as X-XSRF-TOKEN.
Confirm it: in DevTools, open the failed request’s headers. If neither X-CSRF-TOKEN nor X-XSRF-TOKEN is present, this is your cause.
4. The session cookie never arrives, or arrives for the wrong domain
If the token is present but the session cookie is not, Laravel has no session to compare the token against, and the result is still a 419. This is the classic “works on localhost, fails in production” cause, and it lives in config/session.php and your .env:
SESSION_DOMAIN: if your app serves the form fromapp.example.combut posts toexample.com(or the reverse), the session cookie is scoped to one host and invisible to the other. For subdomains that must share a session, setSESSION_DOMAIN=.example.com— leading dot included — so the cookie is valid across subdomains.SESSION_SECURE_COOKIE: set this totrueon HTTPS production sites, but if it istruewhile you are testing over plain HTTP, the browser will refuse to send the cookie at all and every POST will 419. The mismatch in either direction breaks you.SESSION_SAME_SITE: the defaultlaxis right for most apps.noneis only for genuine cross-site cookie use, and it requiressecureto be true —nonewithout HTTPS is rejected by browsers outright.- Scheme and host consistency: if
APP_URLsayshttps://example.combut users reach the app overhttp://, or a redirect changes the host mid-flow, cookies set for one scheme or host will not accompany requests to the other.
Debug this in the browser: in DevTools, Application → Cookies, check whether the session and XSRF-TOKEN cookies are stored for the posting domain and sent with the failing request. A missing cookie points at domain, secure, or same-site settings; a present cookie with a 419 points back at the token.
Confirm it: compare the cookie domain, Secure flag, and SameSite value in DevTools against your .env on the failing environment — not against your local .env.
5. The session store itself is broken
Sometimes the cookie arrives fine and the token is fine, but there is no session on the server to match them against. Laravel 13’s default session driver is database, and the drivers each have a characteristic failure:
- Database driver: the
sessionstable does not exist (runphp artisan make:session-tablefollowed byphp artisan migrate), or a migration was never run on the production database. - Redis or Memcached driver: the cache service is down, unreachable from the app server, or configured with the wrong connection — every session read then fails and every POST 419s.
- File driver:
storage/framework/sessionsis not writable by the web server user, or a deployment wiped the directory. - Stale cached config: you changed
.envon the server but the app is still running on a cached configuration. Clear it withphp artisan config:clear(andcache:clearfor good measure), then re-cache only once the values are confirmed.
Multi-server deployments deserve a special mention: the file driver stores sessions on one server’s disk, so a load balancer that sends the form page from server A and the submit to server B will 419 every time. If you scale past one server, your session driver must be shared.
Confirm it: log in, then check whether a session record actually appears in your store (a row in the sessions table, a key in Redis). No record after a successful page load means the store, not the token, is broken.
6. Your SPA never initialised CSRF with Sanctum
If your frontend is a separate single-page app talking to a Laravel API with cookie authentication, none of the above quite applies — Sanctum adds its own initialisation step, and skipping it is a guaranteed 419. Sanctum’s SPA mode does not use API tokens at all; it uses Laravel’s cookie-based session authentication, which means CSRF protection applies in full.
Before your SPA makes any authenticated request, it must first request the CSRF cookie:
await axios.get('/sanctum/csrf-cookie');
await axios.post('/login', { email, password });
That call sets the XSRF-TOKEN cookie and the session cookie; subsequent requests then pass the forgery check. Three configuration items must also line up, all documented in Sanctum’s SPA section:
- Your SPA and API must share the same top-level domain (different subdomains are fine) — Sanctum only attempts cookie authentication for requests from your own frontend.
- The SPA’s domain must be listed in Sanctum’s
statefulconfiguration, so Laravel treats it as a first-party, stateful caller. - Requests must send the
Accept: application/jsonheader and either aRefererorOriginheader, and Axios must send credentials (withCredentials: true) so the cookies actually travel cross-subdomain.
Confirm it: in DevTools, check that a request to /sanctum/csrf-cookie happens before the first POST, and that the response sets both cookies.
7. The caller is not a browser at all — webhooks and external services
Some 419s are not bugs: the caller is Stripe, PayPal, or another external service posting a webhook, and it cannot know your CSRF token. Take that route out of CSRF protection, narrowly, in Laravel 13:
->withMiddleware(function (Middleware $middleware): void {
$middleware->preventRequestForgery(except: [
'stripe/*',
]);
})
On Laravel 11 or 12, the equivalent call is validateCsrfTokens(except: [...]) in the same bootstrap/app.php file; on Laravel 10 and older, it is the $except property on the VerifyCsrfToken middleware. Alternatively — and often better — move the endpoint to routes/api.php with token authentication, so it is protected by a credential the external service actually holds instead of by an exemption.
Do not widen the exemption to user-facing routes: excluding * or your whole web group removes the protection the 419 was enforcing. Temporarily excluding a route is a legitimate diagnostic step — if the 419 disappears, you have proven the problem is the forgery check — but the exemption comes straight back out once you know.
Confirm it: if the failing requests in your logs have no browser user-agent and no session cookie, they are external callers, not users — exempt the route or move it to the API.
Handle the 419 gracefully when it does happen
Some 419s are correct behaviour: a session genuinely expired while a user wrote a long post. What you control is what the user sees next. Create resources/views/errors/419.blade.php and Laravel will render it instead of the default error page. Keep it short and actionable: explain in plain language that the page expired, tell the user to go back and refresh, and — where your form supports it — preserve their input so a refresh does not eat their work. A one-line “Page expired” with no next step is how a security feature becomes a lost user.
What not to do
- Do not disable CSRF protection globally — every form on your site then becomes submittable by any website your users visit.
- Do not regenerate your application key as a 419 fix — a missing token is not a key problem, and rotating the key invalidates every encrypted cookie and session your users hold.
- Do not crank
SESSION_LIFETIMEto a day as a first resort — it trades an annoyance for a real security exposure and fixes none of the missing-token, missing-header, or broken-store causes. - Do not send the token as a URL query parameter — tokens in URLs leak into logs, referers, and browser history. Use the form field or a header.
- Do not cache a page containing a CSRF token and serve it to other users — a cached form carries the first user’s token, and every other user who submits it will 419.
The 419 checklist
Work top to bottom; stop at the first item that fails:
- Form contains
@csrfand the submitted payload contains_token. - A fresh page load submits successfully (rules out expiry and regeneration).
- JavaScript requests send
X-CSRF-TOKENorX-XSRF-TOKEN(rules out cause 3). - Session and
XSRF-TOKENcookies are stored for the posting domain, with matching Secure and SameSite settings (rules out cause 4). - A session record exists in your store after a page load (rules out cause 5).
- SPAs call
/sanctum/csrf-cookiefirst, with credentials and a stateful domain (rules out cause 6). - The caller is a browser with a session — if not, it is a webhook, and the route needs a narrow exemption or an API home (cause 7).
Follow that order and a 419 stops being a mystery: it is Laravel doing its job, and a short list of places where your app forgot to play along.
Further Reading & References
- Laravel 13.x documentation: CSRF Protection — origin verification,
PreventRequestForgery, exclusions, X-CSRF-Token and X-XSRF-Token. - Laravel 13.x documentation: HTTP Session — session drivers, the database driver and
make:session-table, session regeneration. - Laravel 13.x documentation: Sanctum SPA Authentication — the
/sanctum/csrf-cookieflow, stateful domains, and why first-party SPAs should not use API tokens. - Benjamin Crozat: Laravel 419 Page Expired — fixes that work — the non-standard status code, AJAX and Sanctum notes, and session configuration defaults.
- Codecourse: Laravel 419 Page Expired Error, explained — token expiry, the custom 419 page, and route exclusions.
- Devnote: How to solve 419 Page Expired when submitting forms from a subdomain —
SESSION_DOMAINand the subdomain checklist. - CodeWithSusan: Laravel fix for 419 Page Expired — CSRF Tokens —
@csrfversus the manual hidden field, and which request methods are checked.



