首先在共享托管上访问Laravel应用程序时,CSRF令牌未设置(419页过期)

发布于 2025-01-29 01:06:42 字数 626 浏览 3 评论 0原文

我将Laravel应用程序部署在共享的托管系统中,并且该应用程序正常工作,但是每次我在新浏览器中首次打开网站时,我将post我进行返回错误的请求419,页面过期。之后,该系统正常工作,每个帖子都正确地完成了,但是我不知道为什么第一次在新浏览器中打开系统时,此错误总是会发生csrf_token在代码上是正确的。

<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>

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>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

失去的东西太少 2025-02-05 01:06:42

刚刚在php.ini上添加了此设置,立即工作

; 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

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
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文