how to add cors in couchDB -- No 'Access-Control-Allow-Origin' header is present on the requested resource
From this documentation:
To enable CORS support, you need to set the
enable_cors = true
option in the[httpd]
section oflocal.ini
, and add a[cors]
section containing aorigins = *
setting. Note that by default, no origins are accepted; you must either use a wildcard or whitelist.[httpd] enable_cors = true [cors] origins = *
Accepted answer doesn't solve my problem. What i did is -
update local.ini (/installation location/CouchDB/etc/couchdb)
[httpd]
enable_cors = true
[cors]
origins = *
credentials = true
methods = GET, PUT, POST, HEAD, DELETE
headers = accept, authorization, content-type, origin, referer, x-csrf-token
Then open CMD in administrator mode and run -
net.exe stop "Apache CouchDB" && net.exe start "Apache CouchDB"
*** for windows user only
CORS section in couchdb:
credentials: true
headers: accept, authorization, content-type, origin, referer, cache-control, x-requested-with
methods: GET,PUT,POST,HEAD,DELETE
origins: *
Notice x-requested-with