Fix this error
Laravel: 419 Page Expired
Dasun Kalupahana 104 views
The error
Error
419 | Page Expired
Why it happens
Laravel rejects a POST, PUT, PATCH or DELETE request when its CSRF token is missing or does not match the one in the session. Common reasons:
- The form has no
@csrffield. - The page was open so long that the session expired (default 120 minutes).
- An AJAX request does not send the
X-CSRF-TOKENheader. - The session cookie is not saved: wrong
SESSION_DOMAIN,SESSION_SECURE_COOKIE=trueon plain http, orstorage/framework/sessionsis not writable.
How to fix it
- Add
@csrfinside every form that posts to Laravel. - For JavaScript requests, put the token in a meta tag and send it as the
X-CSRF-TOKENheader (axios in a default Laravel app does this already). - Check
.env:SESSION_DOMAINmust match your domain (or be empty), andSESSION_SECURE_COOKIE=trueonly works over https. - Make sure
storage/is writable, then runphp artisan config:clearand try again in a fresh tab.
<form method="POST" action="/profile">
@csrf
...
</form>
{{-- For fetch / axios --}}
<meta name="csrf-token" content="{{ csrf_token() }}">
<script>
fetch('/profile', {
method: 'POST',
headers: { 'X-CSRF-TOKEN': document.querySelector('meta[name=csrf-token]').content },
});
</script>
Still stuck? Send us the full error and what you tried. We add the answers here.
Learn more on the blog
MySQL
PostgreSQL vs MySQL Performance: Real Benchmarks Compared
Last updated: 7 November 2026. See the update log at the end."Which...
8 min read
Laravel
Secure a Laravel App Before Production: Tested Checklist
Last updated: 8 November 2026. See the update log at the end.Laravel...
12 min read
PHP
How to Detect and Fix PHP Memory Leaks
Last updated: 5 November 2026. See the update log at the end.In...
9 min read