[GH-ISSUE #1] Why is nginx not recommended as a proxy? #759

Open
opened 2026-04-21 22:00:53 -06:00 by gitea-mirror · 5 comments
Owner

Originally created by @tlvince on GitHub (May 5, 2015).
Original GitHub issue: https://github.com/jo/couchdb-best-practices/issues/1

An issue with SSL termination (citation needed) /cc @janl

Originally created by @tlvince on GitHub (May 5, 2015). Original GitHub issue: https://github.com/jo/couchdb-best-practices/issues/1 An issue with SSL termination (citation needed) /cc @janl
Author
Owner

@jo commented on GitHub (May 5, 2015):

Nginx encodes urls on the way through. So, for example, if you request
http://my.couch.behind.nginx.com/mydb/foo%2Fbar it gets routed to CouchDB as /mydb/foo/bar, which is not what we want.

We can configure this mad behaviour away (by not appending a slash to the proxy_pass target :P) but there is no way to convince nginx not messing with the url when rewriting the proxy behind a subdirectory, eg http://my.couch.behind.nginx.com/_couchdb/mydb/foo%2Fbar

Just to mention one argument against nginx ;)

<!-- gh-comment-id:99120245 --> @jo commented on GitHub (May 5, 2015): Nginx encodes urls on the way through. So, for example, if you request `http://my.couch.behind.nginx.com/mydb/foo%2Fbar` it gets routed to CouchDB as `/mydb/foo/bar`, which is not what we want. We can configure this mad behaviour away (by not appending a slash to the proxy_pass target :P) but there is no way to convince nginx not messing with the url when rewriting the proxy behind a subdirectory, eg `http://my.couch.behind.nginx.com/_couchdb/mydb/foo%2Fbar` Just to mention one argument against nginx ;)
Author
Owner

@jo commented on GitHub (May 5, 2015):

3caf71dffb

<!-- gh-comment-id:99123339 --> @jo commented on GitHub (May 5, 2015): 3caf71dffb054aa718133d6c54829570744e93e4
Author
Owner
<!-- gh-comment-id:99128980 --> @jo commented on GitHub (May 5, 2015): https://github.com/eHealthAfrica/ehealth-deployment/issues/151
Author
Owner

@janl commented on GitHub (May 23, 2015):

Here is a another one: https://www.ruby-forum.com/topic/4412004 — Last time I checked this was still not resolved.

<!-- gh-comment-id:104922739 --> @janl commented on GitHub (May 23, 2015): Here is a another one: https://www.ruby-forum.com/topic/4412004 — Last time I checked this was still not resolved.
Author
Owner

@chrispahm commented on GitHub (Apr 22, 2020):

Just stumbled upon this issue, but I thought I'd post a solution that works (at least for my usecase):

For a CouchDB located at http://my.couch.behind.nginx.com/mydb/, I use the following nginx configuration (simplified)

    location /mydb {
      rewrite /mydb/(.*) /$1 break;
      proxy_pass                           http://127.0.0.1:5984;
  }

The solution came up when discussing the issue on stackoverflow

<!-- gh-comment-id:617692980 --> @chrispahm commented on GitHub (Apr 22, 2020): Just stumbled upon this issue, but I thought I'd post a solution that works (at least for my usecase): For a CouchDB located at `http://my.couch.behind.nginx.com/mydb/`, I use the following nginx configuration (simplified) ``` location /mydb { rewrite /mydb/(.*) /$1 break; proxy_pass http://127.0.0.1:5984; } ``` The solution came up when discussing the issue on [stackoverflow](https://stackoverflow.com/questions/45467437/pass-encoded-request-uri-and-remove-string)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/couchdb-best-practices#759
No description provided.