我正在使用 PouchDB 并尝试从 cloudant 服务器进行复制。我还有一个 nodejs 应用程序,它使用此处描述的技术代理对 cloudant 的请求
var request = require('request')
module.exports = function(pattern, host){
return function(req, res, next){
if(req.url.match(pattern)){
var db_path = req.url.match(pattern)[1]
, db_url = [host, db_path].join('/');
req.pipe(request[req.method.toLowerCase()](db_url)).pipe(res);
}else{
next();
}
}
}
app.use(forward(/\/db\/(.*)/, TARGET_URL));
我在我的 pouchdb 上调用复制,如下所示:
db.replicate.from('http://localhost/db/myDb', {continuous: true})
在网络选项卡中查看第一个请求成功,但是发出后续请求,但不是调用http://localhost/db/myDb
它们http://localhost/db
,因此会导致 404。由于某种原因,它已经删除了我的数据库的名称。
知道为什么会这样吗?