here Couchbase server is instaled in AWS.
let headers = new Headers();
var enc = base64.encode('username:password');
headers.set('Authorization', 'Basic ' + enc);
headers.set('Content-Type', 'application/json');
headers.set('Accept', 'application/json');
axios.get(CouchUri, { headers: headers })
.then(resp => {
console.log(resp);
}).catch(err => {
console.log(err);
});
Are you trying to access a Couchbase REST endpoint directly from browser-side JavaScript? If so, that would explain why you’re seeing this error.
There isn’t a way to turn off CORS in Couchbase Server (as far as I know–maybe if you fork and compile your own version).
Yes, Am acessing Couchbase end points from Javascript. how to overcome this CORS issue ? @matthew.groves
The REST endpoints aren’t meant to be called from JavaScript in a browser directly. There are a number of alternative approaches, depending on what you’re building and why. But probably the most common solution is to create a backend (perhaps in Node, since you’re already familiar with JavaScript?) which can itself access the REST endpoints (or just use the Couchbase Node SDK).