4

I am trying to move from Cloudant to Jelastic on flow.ch. I am getting CORS errors with pouchdb when testing locally (ionic serve).

Is there any other configuration in Jelastic besides CouchDB I am missing?

XMLHttpRequest cannot load http://xxx.flow.ch/xxx. Response to preflight request doesn't pass access control check: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'. Origin 'http://localhost:8100' is therefore not allowed access. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute.

  1. I configured a CouchDB on Jelastic and activated CORS. enter image description here enter image description here

  2. Normal access via CURL works. Replication from Cloudant to Jelastic worked as well.

  3. I tried to use a Chrome extension to enable "Allow-Control-Allow-Origin: *"

sideshowbarker
  • 81,827
  • 26
  • 193
  • 197
Sina
  • 240
  • 2
  • 8

1 Answers1

6

The couchdb docs say this:

You can’t set origins = * and credentials = true option at the same time

So if you want cross-origin requests with credentials to work with couchdb, you must set the origins value to an explicit list of allowed origins; for example:

[cors]
origins = http://localhost, https://localhost, http://couch.mydev.name:8080
sideshowbarker
  • 81,827
  • 26
  • 193
  • 197
  • Its not CouchDB specific..Its actually a specification for [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS#Requests_with_credentials). So no server side system which has CORS setup would allow this – Suraj Rao Mar 12 '17 at 04:28