angular - 为 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.
任何形式的帮助将不胜感激。
解决方案
推荐阅读
- python - Flask-Admin MongoEngine column_labels 不起作用
- app-inventor - 使用 App Inventor2 中的 Listpickers 在 2 部手机与 CloudDB 之间进行通信
- serialization - Ansible:无法为顺序执行设置变量
- c - c程序中的分段错误,使用malloc(Linux os)
- angular - *ngIf 函数被无限调用
- firebase - 在线(和登录)时在 Firebase 上保存 Sqflite 数据
- arduino-uno - 如何将输入字符串与声明的字符串进行比较以进行一些进一步的条件操作
- python - 如何根据另一个论点提出一个论点?
- javascript - 需要计算两个日期之间的月差
- java - 在 Java Web 应用程序中使用 LDAP 进行 SSO 身份验证