You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Doug Snyder <we...@gmail.com> on 2017/01/11 23:07:45 UTC

Problems with continuous replication while using NginX as an SSL proxy for a subdirectory

I've got what I think is a common use case,
I'm following the directions for using NginX as a proxy here:
https://cwiki.apache.org/confluence/display/COUCHDB/Nginx+as+a+proxy
They are almost good enough.
They explain how to make a proxy using a subdirectory
and they also explain how to give special treatment for the _changes url to
ensure that continuous replication works OK.
But they don't explain how to do both of those simultaneously.
Perhaps they thought it was obvious? So did I, but what I did doesn't work.
I've got regular REST calls to the non-_changes API working over SSL
but continuous replication fails ( with out an error )
and when I curl:
$ curl http://user:pswd@example.com/couchdb/my_db/_changes
Gives an nginx html error:
<h1>Not Found</h1><p>The requested URL /couchdb/my_db/_changes was not
found on this server.</p>
So the URL handling in my .conf file isn't right.
Here's what I have under the server block of my sites-enabled .conf file :



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;

             proxy_set_header X-Forwarded-Ssl on;

    }

  location ~ ^/couchdb/(.*)/_changes {

            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;

  }

If some one spots what I'm doing wrong please let me know

Best,

Doug

Re: Problems with continuous replication while using NginX as an SSL proxy for a subdirectory

Posted by Sinan Gabel <si...@gmail.com>.
Hi,

Looks fine except there is a missing:  proxy_set_header X-Forwarded-Ssl on;
in the _changes part.

I would start by removing the rewrite and the SSL and test, then add the
SSL and test, and finally add the rewrite and test.

Best regards,


On 12 January 2017 at 00:07, Doug Snyder <we...@gmail.com> wrote:

> I've got what I think is a common use case,
> I'm following the directions for using NginX as a proxy here:
> https://cwiki.apache.org/confluence/display/COUCHDB/Nginx+as+a+proxy
> They are almost good enough.
> They explain how to make a proxy using a subdirectory
> and they also explain how to give special treatment for the _changes url to
> ensure that continuous replication works OK.
> But they don't explain how to do both of those simultaneously.
> Perhaps they thought it was obvious? So did I, but what I did doesn't work.
> I've got regular REST calls to the non-_changes API working over SSL
> but continuous replication fails ( with out an error )
> and when I curl:
> $ curl http://user:pswd@example.com/couchdb/my_db/_changes
> Gives an nginx html error:
> <h1>Not Found</h1><p>The requested URL /couchdb/my_db/_changes was not
> found on this server.</p>
> So the URL handling in my .conf file isn't right.
> Here's what I have under the server block of my sites-enabled .conf file :
>
>
>
> 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;
>
>              proxy_set_header X-Forwarded-Ssl on;
>
>     }
>
>   location ~ ^/couchdb/(.*)/_changes {
>
>             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;
>
>   }
>
> If some one spots what I'm doing wrong please let me know
>
> Best,
>
> Doug
>