I try to send a GET RESTful request to a server with basic authentication. I wrote the following code to achive this task:
module.controller("MainCtrl", ['$scope', '$http', function($scope, $http) {
$http.get('http://192.168.10.15:8080/web/services/api/records/20420?_type=json', {
headers: {
'Authorization' : 'Basic username:password'}
})
.success(function(response) {
console.log("my success");
$scope.values = response;
})
}]
);
When the request is processed, the given error is displayed on the browser console:
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource on http://192.168.10.15:8080/web/services/api/records/20420?_type=json. (Reason: header CORS 'Access-Control-Allow-Origin' missing).
Any Idea?