解决跨域问题

未匹配的标注

config/cors.php 做以下更改

修改 paths,以指示需要保护哪些端点:在本例中为 api/sanctum/csrf-cookie.

'paths' => ['api/*'],

修改 allowed-origins 以指定接受请求的 URL. 这将是你的 React 应用程序的生产和开发 URL,https://233.sx (我的应用程序) and http://localhost:3000.

'allowed_origins' => ['https://233.sx', 'http://localhost:3000'],

然后将 support_credentials 设置为 true.

'supports_credentials' => true,

参见

本文章首发在 LearnKu.com 网站上。

上一篇 下一篇
讨论数量: 0
发起讨论 只看当前版本


暂无话题~