Joshua Foxworth
Joshua Foxworth

Reputation: 1397

New Laravel Build - Timeout on post request

I have a new Laravel project and it has been a while since I had to start one from scratch. I have a simple post request to a controller with the route as below.

Route::post('/JoinUs', 'UserController@functioName');

When the request is sent, I get a status code returned of 419 unknown status. There is a response that says "Sorry, your session has expired. Please refresh and try again." There is no delay in this message being returned.

This makes no sense to me. Is the controller not found? Is the function not found? It seems like there is a config problem somewhere.

Upvotes: 1

Views: 380

Answers (1)

behnam
behnam

Reputation: 225

you should Use @csrf in your form. Like this:

<form method="POST" action="/profile">
    @csrf <------
    ...
</form>

Check this section of the documentation.

Upvotes: 2

Related Questions