When i try to sync from PouchDB to couchbase server using sync gateway i am getting following error..
XMLHttpRequest cannot load http://localhost:4984/test/. Request header field Authorization is not allowed by Access-Control-Allow-Headers in preflight response.
i try to set the header even then i am not able to get rid of this error. Here is my sync gateway config file
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
http://localhost:4985/_admin/db/test/users
I am unable to pin point the error, Please help
via Naveen Gupta
No comments:
Post a Comment