CouchDB + 凭证 + 原始通配符的 CORS 问题 [英] CORS issue with CouchDB + credentials + origin wildcard
问题描述
我正在尝试在 flow.ch 上从 Cloudant 迁移到 Jelastic.在本地测试(离子服务)时,我收到 pouchdb 的 CORS 错误.
除了我缺少的 CouchDB 之外,Jelastic 中还有其他配置吗?
<块引用>XMLHttpRequest 无法加载
可以通过 CURL 正常访问.从 Cloudant 复制到 Jelastic 也同样有效.
我尝试使用 Chrome 扩展来启用Allow-Control-Allow-Origin: *"
您不能同时设置 origins = *
和 credentials = true
选项
因此,如果您希望具有凭据的跨域请求与 couchdb 一起使用,则必须将 origins
值设置为允许的来源的显式列表;例如:
[cors]起源 = http://localhost, https://localhost, http://couch.mydev.name:8080
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.
I configured a CouchDB on Jelastic and activated CORS.
Normal access via CURL works. Replication from Cloudant to Jelastic worked as well.
I tried to use a Chrome extension to enable "Allow-Control-Allow-Origin: *"
You can’t set
origins = *
andcredentials = 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
这篇关于CouchDB + 凭证 + 原始通配符的 CORS 问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!