英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论