PouchDB基本身份validation不适用于同步网关

当我尝试使用同步网关从PouchDB同步到couchbase服务器时,出现以下错误:

XMLHttpRequest无法加载http:// localhost:4984 / test / 。 请求标头字段预检响应中的Access-Control-Allow-Headers不允许授权。

我试图设置头,即使这样我不能摆脱这个错误。 这是我的同步网关configuration文件

sync-gateway-config.json:: { "log":["*"], "databases": { "buildercycle": { "server":"http://localhost:8091", "bucket": "default", "users": { "GUEST": { "disabled": false, "admin_channels": ["*"] } }, "sync":`function(doc, oldDoc) { if (doc.type == "sports"){ channel(doc.type); access(doc.owner,doc.type); } else { channel(doc.type); access(doc.owner,doc.type); } }` } }, "CORS": { "Origin": ["http://localhost:8000","http://localhost:8083", "http://localhost:4985"], "LoginOrigin": ["http://localhost:8000","http://localhost:8083","http://localhost:4985"], "Headers": ["Content-Type"], "MaxAge": 17280000 } } I am trying to sync my PouchDB in following way: remoteCouch="http://"+user+":"+pass+"@localhost:4984/buildercycle"; console.log(remoteCouch); var opts = {live: true,withCredentials: true}; db.sync(remoteCouch,opts,'error'); i am passing user(user1) and password(password) which is defined in following sync_gateway admin URL 

HTTP://本地主机:4985 / _admin / DB /testing/用户

我无法指出错误,请帮助

在标题中添加授权

“标题”:[“内容types”,“授权”],

我认为在你的情况下,Cors header没有正确设置。