when my HTML5 App (i just use the example TODO APP from pouchdb.com) uses an appcache manifest file the sync between the local pouchdb and the remote pouchdb (express-pouchdb) breaks.
The debugger of the chrome reports this error:
Please note that the express app is behind a nginx with basic auth.
Here are the code files for a better understanding:
express index.js:
const express = require('express');
const app = express();
const PouchDB = require('pouchdb');
const path = require('path');
const url = require('url');
const PORT = 8080;
const DB_URL = '/_db';
express.static.mime.define({'text/cache-manifest': ['appcache']});
var pouchHandle = require('express-pouchdb')(PouchDB , {
mode: 'fullCouchDB', // specified for clarity. It's the default so not necessary.
overrideMode: {
exclude: [
'routes/authentication',
// disabling the above, gives error messages which require you to disable the
// following parts too. Which makes sense since they depend on it.
'routes/authorization',
'routes/session'
]
}
});
new PouchDB('todos');
app.use(DB_URL, pouchHandle);
app.use('/app', express.static('public_html'));
app.listen(PORT);
Some parts of the TODO index,js
(function() {
'use strict';
var ENTER_KEY = 13;
var newTodoDom = document.getElementById('new-todo');
var syncDom = document.getElementById('sync-wrapper');
// EDITING STARTS HERE (you dont need to edit anything above this line)
var db = new PouchDB('todos');
var remoteCouch = new PouchDB('https://HOST/_db/todos', {
ajax: {
cache: false,
timeout: 10000,
},
auth: {
username: "user",
password: "pass"
}
});
// Initialise a sync with the remote server
function sync() {
syncDom.setAttribute('data-sync-state', 'syncing');
/*
var opts = {live: true};
db.replicate.to(remoteCouch, opts, syncError);
db.replicate.from(remoteCouch, opts, syncError);
*/
PouchDB.sync(db, remoteCouch , {
live: true,
retry: true
}).on('change', function (info) {
console.log(info);
}).on('paused', syncError).on('active', syncError).on('denied',syncError).on('complete', function (info) {
console.log(info);
}).on('error', syncError);
}
Hi @ll,
when my HTML5 App (i just use the example TODO APP from pouchdb.com) uses an appcache manifest file the sync between the local pouchdb and the remote pouchdb (express-pouchdb) breaks. The debugger of the chrome reports this error:
pouchdb-6.1.1.min.js:9 GET https://HOST/_db/todos/?_nonce=1485504253133 net::ERR_FAILED
Has anyone any ideas to solve this?
Please note that the express app is behind a nginx with basic auth.
Here are the code files for a better understanding:
express index.js:
Some parts of the TODO index,js
TODO appcache file:
nginx default: