'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>
Solution 1:[1]
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
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | pedrogcs |