Possible nginx documentation error
- Dominant language
- Erlang
- Stars
- 7k
- Forks
- 1.1k
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 9
Description
While trying to get couchdb working from behind nginx on a subdirectory address (`x.yz/couchdb`), I was following the [docs](https://docs.couchdb.org/en/stable/best-practices/reverse-proxies.html#reverse-proxying-couchdb-in-a-subdirectory-with-nginx) but couldn't get my setup working with the provided steps.
Using the `nginx.conf` given in the docs, I had 500's because it entered redirect loops. Random changes to the config led to 502's as well as every subsequent subdirectory not working, but I managed with the following:
```nginx
location /couchdb {
rewrite ^/couchdb/(.*) /$1 break;
proxy_pass http://localhost:5984/;
proxy_redirect off;
proxy_buffering off;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Ssl on;
}
```
Changes (compared to the docs) are:
- removal of first rewrite
- replacement of proxy_pass URI with `/`
While this (seemingly) works now, I am completely out of my depth when it comes to nginx so I don't even really know *why* this works and *why* the "official" config didn't (although I'd like to know and learn). Similarly, I can't even say with certainty that the docs are wrong. I just know they didn't work *for me*.
So I'm just letting you know that this was my experience and I'll leave it to much smarter people (aka you) to determine whether the docs are wrong or my config is cursed.
Contributor guide
Research direction
Start with the reverse-proxying CouchDB in a subdirectory with nginx section linked in the issue and compare its provided nginx.conf with the reported working configuration. Reproduce the /couchdb setup if possible, focusing on the two rewrite and proxy_pass differences, then document a verified configuration and explanation of the observed redirect or gateway errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- nginx
- Domain
- documentation, networking
- Issue type
- Documentation
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100