I m writting Ionic app. I
m PouchDB를 로컬 저장소로 사용하고 이러한 데이터를 원격 CouchDB 서버 iriscouch.com에 복제하려고합니다.하지만 작동시키지 못합니다. db를 복제하려고 할 때 아래와 같은 오류가 발생합니다. 내 노트북에 서버 localy를 시작하면 자격 증명없이 작동합니다.PouchDB to CouchDB replication Ionic 앱
var db = new PouchDB('db');
db.replicate.to('https://username:[email protected]:5984/db', {xhrFields:{withCredentials:true}})
//.on('change', function (info) {
// handle change
// console.log("change");
// console.log(info);
.on('uptodate', function (info) {
// handle up-to-date
console.log("uptodate");
console.log(info);
}).on('error', function (err) {
// handle error
console.log("error");
console.log(err);
});
옵션 https://username.iriscouch.com:5984/db/?_nonce=VFSibfdoxcnjKz3V 순 :: ERR_CONNECTION_CLOSED pouchdb.js : 5150
CustomPouchError {메시지 : 정의되지 않은 상태 : 405,하는 statusText : "방법이 허용되지 않음"이름 : "UNKNOWN_ERROR"오류 : 사실 ... } services.js : 내 CouchDB를 24
설정
curl -X PUT $HOST/_config/httpd/enable_cors -d '"true"'
curl -X PUT $HOST/_config/cors/origins -d '"*"'
curl -X PUT $HOST/_config/cors/credentials -d '"true"'
curl -X PUT $HOST/_config/cors/methods -d '"GET, PUT, POST, HEAD, DELETE"'
curl -X PUT $HOST/_config/cors/headers -d '"accept, content-type, origin, referer"'
는 그것이 작동되도록하려면 다음
,var remoteUrl = 'https://username.iriscouch.com/dbname'
var remote = new PouchDB(remoteUrl, {
Auth: {
username: 'username',
password: 'password'
},
live:true,
withCredentials: true
});
어디에 있나요? – bryan