简体   繁体   English

从PouchDB到CouchDB的复制期间出错-“仅允许DELETE,GET,HEAD,POST”

[英]Error during PouchDB to CouchDB replication - “Only DELETE,GET,HEAD,POST allowed”

I'm getting an error when trying to replicate from PouchDB (using http://www.pouchvision.com/ ) to CouchDB (using a local installation). 尝试从PouchDB(使用http://www.pouchvision.com/ )复制到CouchDB(使用本地安装)时出现错误。

Investigating the error with Fiddler, it seems that during a replication PouchDB is calling 研究Fiddler的错误,似乎在复制期间PouchDB正在调用

http://127.0.0.1:5984/targetdb/

using the "OPTIONS" method and that CouchDB returns: 使用“ OPTIONS”方法,并且CouchDB返回:

{
  "error": "method_not_allowed",
  "reason":"Only DELETE,GET,HEAD,POST allowed"
}

I've also used Fiddler to inspect CouchDB to CouchDB replication and in this case the replication makes 2 calls to the same url using the "HEAD" and "GET" methods and all works fine. 我还使用了Fiddler来检查CouchDB到CouchDB的复制,在这种情况下,复制使用“ HEAD”和“ GET”方法对同一URL进行2次调用,并且一切正常。

Questions: Has anybody else had the same problem? 问题:其他人也有同样的问题吗? Am I doing something wrong? 难道我做错了什么? Or is this a bug in PouchDB (or in www.pouchvision.com)? 还是这是PouchDB(或www.pouchvision.com)中的错误?

The OPTIONS request is coming from your browser, not PouchDB. OPTIONS请求来自您的浏览器,而不是PouchDB。 From WikiPedia : 来自WikiPedia

the specification mandates that browsers “preflight” the request, soliciting supported methods from the server with an HTTP OPTIONS request header 该规范要求浏览器“预检”请求,并使用HTTP OPTIONS请求标头从服务器请求支持的方法

The error you're seeing isn't fatal, usually. 通常,您看到的错误不是致命的。 Check your local database to see if replication actually failed. 检查您的本地数据库以查看复制是否确实失败。 If you are only seeing the error from the OPTIONS request, then it's possible replication went without a problem. 如果您仅从OPTIONS请求中看到错误,则说明复制没有问题。

Also make sure you are using the latest CouchDB (1.3.x I beleive) as it has built-in CORS support. 还要确保您使用的是最新的CouchDB(我相信是1.3.x),因为它具有内置的CORS支持。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM