在Mozilla中阻止跨源请求,在chrome中阻止ERR_INSECURE_RESPONSE

时间:2015-08-06 17:01:17

标签: cross-domain

这是我的角度JS代码。几天前工作正常,但现在我得到了下面提到的错误。

AngularJS代码:

app.controller("LoginCtrl",
        function($scope, $http,$location,$rootScope) {
    $scope.login = function(user){
        $http({
            method: "POST",
            url: "https://aadvq11nwbv01.staples.com/wcs/resources/v1/member/login?storeId=10101&responseFormat=json",
            header: "Access-Control-Allow-Origin:*",
            header: "Content-Type: application/json",
            header: "Accept: application/json",
            data:{
                companyID: $scope.user.customerid,
                userID: $scope.user.userid,
                password: $scope.user.password
            }
        })
        .success(function (response){
            $rootScope.profile="xxx";
            userDetails = response;
            console.log(userDetails);
            $location.url("/profile")
        })
        .error(function (err){
            $scope.logerr="err";
        });
    }
});

Chrome错误:

https://aadvq11nwbv01.staples.com/wcs/resources/v1/member/login?storeId=10101&responseFormat=json net::ERR_INSECURE_RESPONSE

Mozilla错误:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://aadvq11nwbv01.staples.com/wcs/resources/v1/member/login?storeId=10101&responseFormat=json. (Reason: CORS header 'Access-Control-Allow-Origin' missing).

0 个答案:

没有答案