Enable CORS on Iris Couch

Following the instructions to enable CORS for my iriscouch :

  • /_config/httpd/cors set to true
  • Add section: /_config/cors/my.iriscouch.com:6984 set to "http://localhost http://myapp.com"

Then check it out:

 $ curl -I https://my.iriscouch.com:6984/ HTTP/1.1 200 OK Server: CouchDB/1.2.0 (Erlang OTP/R15B) Date: Tue, 02 Oct 2012 10:49:18 GMT Content-Type: text/plain; charset=utf-8 Content-Length: 40 Cache-Control: must-revalidate 

but no Access-Control-Allow-Origin in the answer ...

Also tried restarting the server:

 $ curl -XPOST -HContent-Type:application/json https://me: XXXX@my.iriscouch.com :6984/_restart {"ok":true} 

But no longer luck ...

-

Has anyone successfully resolved CORS for their toffee?

Note. The CORS patch should already be applied to my account.

Thanks.

+4
source share
3 answers

I did this using the following configuration:

 section | option | value ------------------------------- cors | credentials | true cors | origins | * httpd | enable_cors | true 

Also, if you are making any ajax requests from your web application, make sure you pass the withCredentials parameter to true .

Example for AngularJS:

 $http({withCredentials: true, ...}).post(...) 
+4
source

If you open the Configuration tool, you will find enable_cors under httpd . You want to change this value to true .

Further, if you scroll down the page, you will find the link “ Add a new section ”. You want to click on it and add the Sources option with a value of * in the cors section. You can set the origin to the actual URL, but that will allow CORS for everyone.

This is how I earned from me.

+2
source

It seems now possible. I have included CORS, although I have not tested it yet. I just started playing with CouchDB.

Check the configuration. CORS must be disabled. http://YOURDOMAIN.iriscouch.com/_utils/config.html

See add-cors-to-couchdb installation instructions http://pouchdb.com/getting-started.html

Execute: add-cors-to-couchdb https://YOURDOMAIN.iriscouch.com:6984 -u USERNAME -p PASSWORD

Result: Success

Check the configuration again. Must show CORS enabled. http://YOURDOMAIN.iriscouch.com/_utils/config.html

+1
source

Source: https://habr.com/ru/post/1437367/


All Articles