Although I am passing header Access-Control-Allow-Origin
in the request like this:
$http({ method: 'GET',
url:$APIs_server + "api/get-all-notifications",
headers: {
'Access-Control-Allow-Headers': 'Content-Type',
'Access-Control-Allow-Origin':'*',
'Access-Control-Allow-Methods': 'GET, POST, OPTIONS',
'Authorization': JWT_token
}
}).success(function (response) {
//console.log("response.data: ", response.data);
if (response.data != undefined)
$scope.populate_notifications(response.data);
});
I got an error No 'Access-Control-Allow-Origin' header is present on the requested resource
, here is the full error:
XMLHttpRequest cannot load http://localhost:9902/api/get-all-notifications. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8000' is therefore not allowed access. The response had HTTP status code 405.
Please advice if someone can explain?