【发布时间】:2015-07-31 15:48:30
【问题描述】:
我的 Angular 应用通过 Apache 的跨域请求在 Google Chrome 上运行,但在 Firefox 上失败并出现 Error: a security problem occurred 错误。
这是我的Django 应用程序的Apache 配置:
<Location />
Header always set Access-Control-Allow-Origin http://stage.myangularsite.com
Header always set Access-Control-Allow-Methods "POST, GET, OPTIONS, DELETE, PUT"
Header always set Access-Control-Max-Age "1000"
Header always set Access-Control-Allow-Credentials: true
Header always set Access-Control-Allow-Headers "x-requested-with, Content-Type, origin, authorization, authentication, accept, client-security-token"
Header always set Access-Control-Request-Headers "x-requested-with, Content-Type, origin, authentication, client-security-token"
AuthType Basic
AuthName "Authentication Required"
AuthUserFile "/home/user/.htpasswd"
Require valid-user
</Location>
仅供参考,在接收应用程序上,我使用的是 django-cors-headers 和 django-rest-framework。
【问题讨论】:
标签: angularjs django django-cors-headers