Angular跨域请求适用于Chrome,在Firefox和IE上失败

时间:2015-05-19 17:13:45

标签: angularjs django django-cors-headers

我的Angular应用程序通过Apache在Google Chrome上运行的跨域请求,但在Firefox上失败并出现Error: a security problem occurred错误。

以下是我的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-headersdjango-rest-framework

1 个答案:

答案 0 :(得分:0)

我认为您正在寻找的是xDomain Library

你可以在这个问题上找到一些信息: