TR EN

Laravel 419 Page Expired: Forms, Fetch and Session Checks

Laravel 419 Page Expired commonly signals a mismatch between the CSRF token and session. The status alone does not identify the incorrect setting.

Start with the version and failing request

Run php artisan --version and inspect the failed request’s method and URL in your browser’s Network panel. 419 is unassigned in the IANA HTTP status registry.

Laravel 13 difference: the default request-forgery middleware first checks same-origin provenance using Sec-Fetch-Site, then falls back to token validation. Origin-only mode can reject with 403. Compare your configuration with the 13.x documentation.

1. A regular Blade form

Include @csrf in a protected form to generate its hidden token field. Adapt this example to your own POST route and fields:

<form method="POST" action="/profile">
    @csrf
    <button type="submit">Save</button>
</form>

If a freshly opened form works but an old tab fails, investigate session renewal. Preserve unsent text before signing in again. Record when the failure starts instead of increasing the lifetime arbitrarily.

2. Same-origin Fetch / AJAX

You can pass the Blade meta token through X-CSRF-TOKEN. The cookie-based X-XSRF-TOKEN mechanism uses a different value; do not mix them. See the Laravel 12 header documentation.

<!-- In a Blade view served by your own application -->
<meta name="csrf-token" content="{{ csrf_token() }}">
<script>
async function saveProfile(displayName) {
    const response = await fetch('/profile', {
        method: 'POST',
        credentials: 'same-origin',
        headers: {
            'Accept': 'application/json',
            'Content-Type': 'application/json',
            'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]').content
        },
        body: JSON.stringify({ display_name: displayName })
    });
    return response.status;
}
</script>

This example is same-origin only. It neither creates the route nor calls the function automatically. In your own browser, check that the session cookie accompanies the correct token header. Do not paste tokens, cookies or real form payloads into external diagnostic services.

3. Trace cookie and session continuity

  • Cookie absent: read the browser’s blocking reason and inspect Domain, Path, Secure and SameSite. Confirm the expected hostname and HTTPS are in use.
  • Intermittent failure: correlate the same request flow with time and server node. On multiple nodes, check that each can retrieve the same session.
  • Session disappears: inspect the existing driver in config/session.php and access to its backing store. Do not switch to file without diagnosing the deployment. See session configuration.

4. SPA / Sanctum or an external webhook

Sanctum’s SPA flow requires coordinated first-party domains, cookie scope and client credentials settings. For a separate subdomain, follow the Sanctum SPA guide and our CORS guide.

An external webhook sender does not carry your browser session. Design that route’s middleware separately using your version’s documentation and implement the provider’s signature verification. Keep the application’s CSRF protection enabled. Our webhook tool inspects synthetic test requests; it cannot validate your application session.

Verify the actual fix

Retry the same method and route in a fresh session, then reproduce the wait or subdomain condition that triggered the failure. After changing configuration, rebuild its cache through your production deployment process. Blanket cache clearing is not a diagnosis. See Laravel deployment guidance.

If the request still fails, correlate its ID, time and redacted error type. Use our 401 guide for authentication rejection or 500 guide for an application exception. Reviewed: .

Frequently Asked Questions

Will increasing SESSION_LIFETIME alone fix 419?
A lifetime policy is relevant only if expiry has been established. A missing token, omitted cookie or inaccessible session store requires a different diagnosis.
Why can tests pass while production returns 419?
First check whether the protection middleware actually runs in the test environment. Compare production HTTPS, cookie scope, subdomains and session storage using the same request.
Can an SSL checker validate my CSRF token?
No. A TLS check examines certificate-related connection behavior. Investigate the CSRF and session match inside your application and browser.