Security Laravel 8 Laravel 9 Laravel 10 Laravel 11 Laravel 12

419 Page Expired Error in Laravel - CSRF Token Fix

The 419 Page Expired error occurs when Laravel's CSRF token is missing, expired, or invalid during form submission.

The Error

Error Message
419 Page Expired

Common Causes

  1. 1 Missing @csrf directive in form
  2. 2 Session expired while form was open
  3. 3 CSRF token not included in AJAX request headers
  4. 4 Mismatched session domain configuration
  5. 5 Cookie/session configuration issues

Solutions

1

Add @csrf directive to your form

Blade
<form method="POST" action="/submit">
    @csrf
    <!-- form fields -->
</form>
2

Add CSRF token to AJAX requests

JavaScript
$.ajaxSetup({
    headers: {
        'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
    }
});
3

Add meta tag for CSRF token

Blade
<meta name="csrf-token" content="{{ csrf_token() }}">
4

Exclude route from CSRF verification (use cautiously)

PHP
// In VerifyCsrfToken.php
protected $except = [
    '/webhook/*',
];

Need Help With Your Laravel Project?

I specialize in building custom Laravel applications, process automation, and SaaS development. Whether you need to eliminate repetitive tasks or build something from scratch, let's discuss your project.

Currently available for 2-3 new projects

Hafiz Riaz

About Hafiz

Full Stack Developer from Italy. I build web applications with Laravel and Vue.js, and automate business processes. Creator of ReplyGenius, StudyLab, and other SaaS products.

View Portfolio

Related Errors