[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

Hi @alexbran8,

We have documentation on this feature over here - Cross-Origin Resource Sharing (CORS) | Couchbase Docs

Although I see from the Stack Overflow Post you’ve already tried using the Advanced settings to set this up. We’ve tested this feature very recently and its performing as expected, we’d recommend attempting to view your network requests ensuring that the browser is correctly setting the Origin header to the one you’ve added to the allowed list.

If you’re a paid customer you could open a support ticket and provide a HAR file so we can review.

Thanks!