Fauxton (CouchDB manager) behind Nginx is not fully working. Following Nginx block from CouchDB Wiki is not working at all:
location /couchdb {
rewrite /couchdb/(.*) /$1 break;
proxy_pass http://localhost:5984;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
When I change the location /couchdb part with location ^~ /couchdb, it starts working by displaying Fauxton at least.
Inspection (Chromium Inspector) shows the problem as the /_session url is requested from https://example.com/_session instead of https://example.com/couchdb/_session, which means that Fauxton can not determine correctly that it is served within a subdirectory (adding a proxy block for /_session url solves the 404 issue) That's why I dumped the request on CouchDB host with nc -l -p 5984 to see what the headers are set to:
GET /_utils/ HTTP/1.1
Host: example.com
X-Forwarded-For: 127.0.0.1
X-Real-IP: 127.0.0.1
I'm not sure if X-Forwarded-For header is set correctly or not. What is the expected headers here? How can I determine if the problem is with my Nginx setup or there is another issue with - for example - my firewall (iptables) settings?
Edit
Possible problem is with Fauxton, not with CouchDB: https://github.com/apache/couchdb-fauxton/issues/944