[CORS] PouchDB - Capella [CORS]

I’m trying to connect PouchDB directly to a Capella endpoint for the React Web version of our app but getting CORS error.

Have tried to set up a proxy server => It works using it.

Setup:

const localDB = new PouchDB('tasks');
const remoteDB = new PouchDB('https://my-capella-endpoint.cloud.couchbase.com/test', {
    auth: {
        username: 'my_username',
        password: 'my_password'
    }
});

Error:

Acces to fetch ____ has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

Questions:
Is direct PouchDBCapella connection supported and if yes, how to configure CORS properly?

Has anyone successfully done this? Any help appreciated!

2 Likes