Hi Max,

Sorry for not being able to answer your actual question, I still want to
draw your attention to the need for further nginx location needs (i.e.
_changes): Here's an example of a working configuration when listening at
the root / and using ssl.

    location ~ ^/(.*)/_changes {
        proxy_pass http://couchdb_node;

        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;
    }

    location / {
        proxy_pass http://couchdb_node;

        proxy_redirect off;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Ssl on;
    }

On 12 March 2018 at 11:08, Jan Lehnardt <j...@apache.org> wrote:

> Hi Max,
>
> this is more an nginx than a CouchDB question, but
> https://serverfault.com/questions/459369/disabling-
> url-decoding-in-nginx-proxy#463932 suggests that if you use proxy_pass
> without a uri (not even a slash), that things should work.
>
> Can you verify you’re using `proxy_pass http://localhost:5984;` and not
> e.g. `proxy_pass http://localhost:5984/;`. If you are, you should open a
> ticket with the nginx team.
>
> Best
> Jan
> --
>
>
>
> > On 12. Mar 2018, at 10:20, max <maxima...@gmail.com> wrote:
> >
> > Hi,
> >
> > To make CouchDB listen as sub directory, doc says (
> > https://cwiki.apache.org/confluence/display/COUCHDB/Nginx+as+a+proxy) to
> > use:
> > 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;
> > }
> >
> > But this cannot be used for attachment with special character such as +,
> > -,  ,
> > For those CouchDB will send back: "{"error":"not_found","reason"
> :"Document
> > is missing attachment"}"
> >
> > The only way I found to fix it is:
> > location /couchdb/ {
> >        rewrite ^ $request_uri;
> >        rewrite ^/ couchdb /(.*) $1 break;
> >        return 400;
> >        proxy_pass http://127.0.0.1:5984/$uri;
> > }
> >
> > But doing so I cannot access CouchDB root (http://127.0.0.1/couchdb)
> since
> > it will result in Nginx 500 error (zero length URI).
> >
> > Do you know a better Nginx configuration?
> >
> > Thanks,
> >
> > Max
>
> --
> Professional Support for Apache CouchDB:
> https://neighbourhood.ie/couchdb-support/
>
>

Reply via email to