首页 > 解决方案 > 为 Docker 开发环境启用 CORS

问题描述

为我的 Docker 开发环境启用 CORS 的最佳方法是什么?我的应用程序在本地运行良好,但是一旦用户通过 Identity Server 登录,我的应用程序的 API 就无法将数据库信息拉到 Angular 前端。

使用 nginx 容器在我的应用程序中启用 CORS 是否有意义?似乎有相当数量的文档。

当我在 Docker 登录后运行我的应用程序时,我不断从控制台收到的错误消息是:

Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:5004' is therefore not allowed access. The response had HTTP status code 500.

任何形式的帮助将不胜感激。

标签: angularapidockeridentityserver4

解决方案


推荐阅读