1
我的Angular應用程序通過Google Chrome上的Apache工作發出的跨域請求,但在Firefox上出現Error: a security problem occurred
錯誤。角度跨域請求在Chrome上運行,在Firefox和IE上失敗
這裏的Apache
配置我Django
應用:
<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
。