Laravel 10 – Breeze, React, Inertia – 初次安装时出现 419 错误

huangapple go评论67阅读模式
英文:

Laravel 10 - Breeze, React, Inertia - 419 error on initial install

问题

不确定在这里该怎么做,我已经搭建了一个全新的Laravel 10.0.3应用程序,安装了Laravel Breeze并选择了React,没有选择SSR。

我已经迁移了我的数据库并设置了我的.env文件,基本上如果我使用php artisan serve,Inertia响应可以正常工作,不会出现419错误。但是,如果我将.env文件中的APP_URL更改为除localhost之外的不同域名,请求就无法正常工作,会返回419错误。

我如何更改.env文件中的URL并保持正确的Inertia响应?我是否需要发布一些设置,或者将我的自定义域名添加到会话配置或其他配置中?提前感谢。

英文:

Really not sure what to do here, I have set up a fresh Laravel 10.0.3 application, installed Laravel Breeze and selected React and no to SSR.

I have migrated my DB and setup my .env, basically if I use php artisan serve the Inertia response works and does not error with a 419 however if I change the APP_URL in the env to a different domain other than localhost, the request does not work and returns the 419.

How can I change the URL in my .env file and maintain the correct intertia response? Do I have to vendor publish some settings, or add my custom domain to a session config or any other config for that matter? Thanks in advance.

答案1

得分: 0

我解决了这个问题,我在加载页面后更改了我的 APP_URL,所以会话cookie是旧的,删除了我的cookie后,它按预期工作。

英文:

I worked it out, I had changed my APP_URL after I had loaded the page so the session cookie was old, after deleting my cookies it worked as expected.

huangapple
  • 本文由 发表于 2023年2月26日 22:37:45
  • 转载请务必保留本文链接:https://go.coder-hub.com/75572702.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定