小编bal*_*ear的帖子

如何解决 Strapi 生产构建中的 CORS 策略问题?

现在有没有人如何修复 Strapi 后端的 CORS 错误?我收到一条类似的消息,如下所示。我用 example.com 替换了我的域:

访问从源 ' https://blog.strapi.io/ghost/api/v0.1/posts/?client_id=ghost-frontend&client_secret=1f230799b4ec&limit=2 ' http://backend.example.com:1337 获取' 已被 CORS 策略阻止:对 ' http://backend.example.com:1337/admin ' 预检请求未通过访问控制检查的响应:没有 'Access-Control-Allow-Origin' 标头存在于请求的资源。如果不透明响应满足您的需求,请将请求的模式设置为“no-cors”以在禁用 CORS 的情况下获取资源。

我尝试向 config/environments/production/security.json 添加一个来源

“起源”: ”*”

"origin": "backend.example.com"

他们都没有工作。我仍然收到错误。

我会很感激这方面的一些帮助。

nginx strapi

6
推荐指数
2
解决办法
5295
查看次数

标签 统计

nginx ×1

strapi ×1