Hi,
I have a local javascript html page on my PC. It tried to do http GET a N1QL query against a remote N1QL engine on server dev08.
.
I got error
"Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote
resource at http://dev08:8093/query?statement=SELECT%20*%20FROM%20system:keyspaces.
This can be fixed by moving the resource to the same domain or enabling CORS."
How can I enable CORS from the cbe-engine running on a remote server?
My test script on my local PC, which is run when I open it from Chrome or Firefox.
<!doctype html>
Hello N1QL<body>
<div ng-controller="HelloCB">
<p>The RequestID is {{greeting.requestID}}</p>
</div>
<script>
function HelloCB($scope, $http) {
$http.get('http://ev08:8093/query?statement=SELECT%20*%20FROM%20system:keyspaces')
.success(function(response){
result = angular.fromJson(response.data);
$scope.greeting = result;
}).error(function(response) {
$scope.greeting = "error "+ response.status;
});
}
</script>
</body>
thanks,
Kha Tran