Skip to content

Instantly share code, notes, and snippets.

@nolanlawson
Created February 19, 2015 20:25
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nolanlawson/3bedd08dbc17c5c3bdf7 to your computer and use it in GitHub Desktop.
Save nolanlawson/3bedd08dbc17c5c3bdf7 to your computer and use it in GitHub Desktop.
CouchDB in an Nginx reverse proxy
# this is the config I always use, to route http://mysite.com/couchdb to localhost:5984.
location /couchdb {
rewrite /couchdb(.*) $1 break;
proxy_pass http://127.0.0.1:5984;
proxy_redirect off;
proxy_buffering off;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
@musamusa
Copy link

this will not work for CouchDB 2.x.x

@ceremcem
Copy link

@musamusa The following configuration works for CouchDB 2.x.x:

   location ^~ /couchdb/ {
        proxy_pass http://10.0.81.192:5984/;
        proxy_redirect off;
        proxy_buffering off;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment