How to enable CORS on N1QL engine


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
    <div ng-controller="HelloCB">
        <p>The RequestID is {{greeting.requestID}}</p>

function HelloCB($scope, $http) {
            result = angular.fromJson(;
            $scope.greeting =  result;
        }).error(function(response) {
            $scope.greeting = "error "+ response.status;


Kha Tran


Hi Kha Tran,

N1QL does not currently support CORS enablement; however this is a feature we can add if it would prove useful. I’ve filed a feature request here: