You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by GitBox <gi...@apache.org> on 2019/12/07 06:33:42 UTC
[GitHub] [couchdb-fauxton] W1M0R commented on issue #1199: Provide mechanism
for hosting in subdirs behind reverse proxies
W1M0R commented on issue #1199: Provide mechanism for hosting in subdirs behind reverse proxies
URL: https://github.com/apache/couchdb-fauxton/issues/1199#issuecomment-562820118
The method that worked for me was to let nginx proxy the /couchdb/_utils/ location to the npm version of fauxton running inside a docker container. All requests to _utils are thus not satisfied by the built-in couchdb fauxton, but instead by the standalone fauxton server.
Here are some hints for the steps required to make this work.
The NGINX configuration at `/etc/nginx/conf.d/default.conf`:
```nginx
upstream couchdb {
server app-couchdb:5984;
}
upstream fauxton {
server app-fauxton:8000;
}
server {
listen 80;
server_name localhost;
location /couchdb/_utils/ {
rewrite /couchdb/_utils/(.*) /$1 break;
proxy_pass http://fauxton/;
proxy_redirect off;
proxy_buffering off;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
location /couchdb {
rewrite /couchdb/(.*) /$1 break;
proxy_pass http://couchdb/;
proxy_redirect off;
proxy_buffering off;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
...
}
```
The CouchDB configuration at `/opt/couchdb/etc/local.d/docker-1.ini`:
```ini
[chttpd]
bind_address = 0.0.0.0
[httpd]
enable_cors = true
bind_address = 0.0.0.0
```
The Dockerfile for the fauxton:alpine image at `fauxton.dockerfile`:
```dockerfile
FROM node:10-alpine
RUN npm install --silent -g fauxton
```
The docker configuration:
```sh
sudo docker build -t fauxton:alpine - < ./fauxton.dockerfile
sudo docker network create app-net
sudo docker create --name app-couchdb --network app-net --restart unless-stopped -v /opt/couchdb/etc/local.d/docker-1.ini:/opt/couchdb/etc/local.d/docker-1.ini -e COUCHDB_USER="$ADMIN_USER" -e COUCHDB_PASSWORD="$ADMIN_PASSWORD" couchdb:latest
sudo docker create --name app-fauxton --network app-net --restart unless-stopped fauxton:alpine fauxton --couchdb "http://app-couchdb:5984"
sudo docker create --name app-nginx --network app-net --restart unless-stopped --publish 8080:80 -v /etc/nginx/conf.d/default.conf:/etc/nginx/conf.d/default.conf:ro nginx:alpine
sudo docker start app-couchdb
sudo docker start app-fauxton
sudo docker start app-nginx
```
That should more or less give you a setup with the latest version of couchdb and the latest version of standalone fauxton, all running inside docker containers, and accessible via a non-root path at http://127.0.0.1:8080/couchdb/_utils/.
This solution will work for people who are having the following issues:
1. https://github.com/apache/couchdb-fauxton/issues/944
1. https://github.com/apache/couchdb-fauxton/issues/1188
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services