相关疑难解决方法(0)

Strapi v4 抛出 cors 异常

我是 Strapi 的新手,我已经下载了 Strapi v4,并且我使用 vue.js 作为前端。

\n

现在我创建了类别,并尝试使用我的 vue 应用程序获取这些类别,但我\xe2\x80\x99m 收到 cors 错误。

\n
Access to XMLHttpRequest at \'http://localhost:1337/api/categories\' from origin \'http://localhost:8080\' has been blocked by CORS policy: The value of the \'Access-Control-Allow-Origin\' header in the response must not be the wildcard \'*\' when the request\'s credentials mode is \'include\'. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute.\n
Run Code Online (Sandbox Code Playgroud)\n

文档中中,我看到我可以覆盖 cors 中间件上的原点,但我不知道怎么做。

\n

我\xe2\x80\x99已经尝试过解析,然后设置配置,但这破坏了cms。

\n
  {\n    resolve: \'strapi::cors\',\n    config: {\n …
Run Code Online (Sandbox Code Playgroud)

javascript cors strapi

5
推荐指数
1
解决办法
8151
查看次数

标签 统计

cors ×1

javascript ×1

strapi ×1