apache / couchdb-fauxton

Fauxton is the new Web UI for CouchDB

Home Page:https://github.com/apache/couchdb-fauxton

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Non-root setup doesn’t work anymore

sloonz opened this issue · comments

Fauxton 1.1.16 fixed #944, which allowed to do something like that with PouchDB :

var PouchDB = require('pouchdb');
var express = require('express');
var app = express();

var pouch = require('express-pouchdb')(PouchDB, {
    overrideMode: {
        exclude: ['routes/fauxton']
    }   
});

app.use('/foo/bar/db/_utils', express.static('couchdb-fauxton/dist/release'));
app.use('/foo/bar/db', pouch);

app.listen(3000);

This is broken in current master ; database listing works, but clicking on a database to view documents crashes (for example http://localhost:3000/foo/bar/db/_utils/#database/_users/_all_docs). After a git bisect, the culprit seems to be commit 5ed7933.

Network console shows that Fauxton requests the database at one level too high : http://localhost:3000/foo/bar/_users (should be http://localhost:3000/foo/bar/db/_users). It looks like a double-application of app.root in fetchDatabaseInfo (app/addons/databases/api.js) : adding console.log({ databaseName, base, url }) here yields { databaseName: "_users", base: "../_users", url: "../../_users" }.

We see the same problem running the latest official docker image (2.3.0) on a relative path (/couchdb/) behind a reverse proxy. This essentially renders Fauxton unusable for reviewing and editing database entries.

I confirmed the issue and submitted a fix in #1191

nice work!