CouchDB + 凭据 + 来源通配符的 CORS 问题

CORS issue with CouchDB + credentials + origin wildcard

我正尝试在 flow.ch 从 Cloudant 迁移到 Jelastic。我在本地测试(离子服务)时遇到 pouchdb 的 CORS 错误。

除了我缺少的 CouchDB 之外,Jelastic 中还有其他配置吗?

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. 我在 Jelastic 上配置了 CouchDB 并激活了 CORS。

  2. 通过 CURL 的正常访问有效。从 Cloudant 到 Jelastic 的复制也同样有效。

  3. 我尝试使用 Chrome 扩展来启用 "Allow-Control-Allow-Origin: *"

couchdb docs say this:

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

因此,如果您希望带有凭据的跨域请求与 couchdb 一起使用,则必须将 origins 值设置为允许来源的明确列表;例如:

[cors]
origins = http://localhost, https://localhost, http://couch.mydev.name:8080