skip to Main Content

I’ve upload a Laravel 7 project on cpanel. All post methods give a 419 - page expired error, but it works fine in localhost.

I’ve set all @csrfs exactly on the forms. I’ve set session domain in env file. But it still doesn’t work.

Instead, it returns:

TokenMismatchException in VerifyCsrfToken.php line 53

3

Answers


  1. Chosen as BEST ANSWER

    I solved this problem with migrating website from http to https


  2. Do you have CSRF in your header?

    <!-- CSRF token -->
    <meta name="csrf-token" content="{{ csrf_token() }}">
    
    Login or Signup to reply.
  3. Add in your form on .blade.php file {{ csrf_field() }} or @csrf like this

    <form method='POST' action='route("exampleRoute")'>
       {{ csrf_field() }} or @csrf
    
          <div class="form-group">
                <label for="exampleInputEmail1">STitle</label>
                <input type="text" name='title' class="form-control" id="exampleInputEmail1" value="">
          </div>
       ....
       ....
    </form>
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search