简体   繁体   中英

laravel 5.8.7 Page expired (419)

I am submitting a POST request from form and it shows 419 | page expired.

Blade.php:

<form action="<?php echo action('TestsController@store'); ?>" method="post">

Route:

Route::resource('tests', 'TestsController');

Controller:

public function store(Request $request) {
        echo "something something";
}

Laravel has built-in CSRF protection. Check out the official documentacion.

Add @csrf to you form.

<form action="<?php echo action('TestsController@store'); ?>" method="post">
    @csrf
</form>

As Levente said, first try by putting the @csrf in the form. If that doesn't work, see this thread . It is a duplicate of this issue.

In my case, I have solved the problem by setting SSL for my domain. I've tried all the solution, but they didn't work. Then I set the SSL for the domain and it solved the problem.

in my case another admin user logged in in my custom Admin panel with OTP

and so he cant login with this new laravel/ui auth login/register default page

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM