pedrogcs
pedrogcs

Reputation: 51

CSRF token is not set when first accessing Laravel Application on shared hosting (419 Page Expired)

I deployed my laravel application in a shared hosting system and the application works fine, but every time I open the website for the first time in a new browser the first POST request that I make returns error 419, page expired. After that the system works fine, every POST is made correctly but I don't know why always this error happens the first time the system is opened in a new browser. The csrf_token is correct at the code.

<form method="POST">
            @csrf   

            <input class="fields" name="user" placeholder="Email"/><br/>
            <input class="fields" name="password" type="password" placeholder="Senha"/><br/>
            <input class="entrarbtn" value="Entrar" type="submit"/><br/>
</form>

Upvotes: 1

Views: 562

Answers (1)

pedrogcs
pedrogcs

Reputation: 51

just added this settings on php.ini and works now

; cPanel-generated php ini directives, do not edit
; Manual editing of this file may result in unexpected behavior.
; To make changes to this file, use the cPanel MultiPHP INI Editor (Home >> Software >> MultiPHP INI Editor)
; For more information, read our documentation (https://go.cpanel.net/EA4ModifyINI)

output_buffering = 16384

Upvotes: 2

Related Questions