PouchDB and Couchbase Sync Gateway Synchronization - CORS Error

I need help synchronizing PouchDB with Couchbase Sync Gateway.

I keep getting the following error indicating a CORS problem, but I configured Couchbase Sync Gateway (CSG) for CORS according to their documentation.

XMLHttpRequest cannot load http://localhost:4985/test-database/.
No 'Access-Control-Allow-Origin'header is present on the requested
resource. Origin 'http://localhost:3000' is therefore not 
allowed access.

I tried the following configuration file in CSG docs:

http://developer.couchbase.com/documentation/mobile/1.2/develop/guides/sync-gateway/configuring-sync-gateway/config-properties/index.html

{
  "log": ["HTTP+"],
  "CORS": {
    "origin":["http://localhost:3000"],
    "loginOrigin":["http://localhost:3000"],
    "headers":["Content-Type"],
    "maxAge": 1728000
  },
  "databases": {
    "test-database": {
      "server": "walrus:",
      "users": { "GUEST": {"disabled": false, "admin_channels": ["*"] } }
    }
  }
}

I also tried other configuration files from the Couchbase blog, but none of them work! Any help with this would be greatly appreciated!

+4
source share
2 answers

, Sync Gateway, , , CORS. (4984)?

+4

CORS CouchDB. , - (: http://, https://), .

CORS CouchDB curl - Futon, , Node script, add-cors-to-couchdb. :

npm install -g add-cors-to-couchdb
add-cors-to-couchdb

.
https://pouchdb.com/errors.html#no_access_control_allow_origin_header

-1

All Articles