You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@couchdb.apache.org by Benoit Chesneau <bc...@gmail.com> on 2008/04/17 10:20:49 UTC

problem with couchdb behing nginx

Hi,

 I would like to use couchdb (last trunk) behind nginx so I use this
configuration :
    server {
          listen        80;
          server_name   couchdb;
            location / {
            proxy_pass http://127.0.0.1:5984;
            proxy_redirect off;
            proxy_set_header   Port             $proxy_port;
            proxy_set_header   X-Real-IP        $remote_addr;
            proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
        }
    }

 But it doesn't work. I can access to futon, and other pages, but db
 aren't listed and basically I can't do anything on the db. Same result
 whe I use a python script that acess to couchdb via nginx. Is there
 something I missed ? It's really weird anyway.

 - benoît

Re: problem with couchdb behing nginx

Posted by Benoit Chesneau <bc...@gmail.com>.
I provided a patch to fix this problem. No more chunk are sent when
you ask for an http 1.0 answer (which is the case of nginx and other
proxies).

This patch provide valid http 1.0 : no chunk and content-length. It
also fix couch.js to have a valid request header over such proxy (body
can't be null). This patch don't break http 1.1 comatibility. So if
you converse with couchdb in http 1.1 everything works as usual.

Patch :

https://issues.apache.org/jira/secure/attachment/12380544/compat_http10_couchdb_r649048.diff

issue related to this problem :
https://issues.apache.org/jira/browse/COUCHDB-40

ok for this ?



- benoît

Re: problem with couchdb behing nginx

Posted by Benoit Chesneau <bc...@gmail.com>.
On Thu, Apr 17, 2008 at 2:15 PM, Benoit Chesneau

>  since all the requests are done behind the proxy, I don't think it
>  could be a cross-scripting issue, I will investigate on it anyway :)
>
>  - benoît
>
i confirm this. Everithing work, except I get a non parsed chunk in
the response.
- benoît

Re: problem with couchdb behing nginx

Posted by Benoit Chesneau <bc...@gmail.com>.
On Thu, Apr 17, 2008 at 2:07 PM, Ralf Nieuwenhuijsen
<ra...@gmail.com> wrote:
> My first guess would be that this is related to most browsers not
>  allowing cross-site scripting. But looking at the log, the request
>  actually takes place..
>
>  You want to make sure, not only to proxy one-way, but also to
>  reverse-proxy. (that made all the difference for me proxying on
>  apache2)
>
>  Perhaps you should check the javascript-error-console and see if there
>  is anything there.
>  Does manually retrieving the list of databases work?
>
>   http://127.0.0.1:5984/_all_dbs
>
>  If so, the error has to do with proxying and cross-site-scripting
>  security of the browser.
>
>  Greetings,
>  Ralf
>
>

in fact it should be related to the response send by couchdb server.
Nginx wait for a valid HTTP/1.0 response and get http chunked :

https://issues.apache.org/jira/browse/COUCHDB-40

since all the requests are done behind the proxy, I don't think it
could be a cross-scripting issue, I will investigate on it anyway :)

- benoît

Re: problem with couchdb behing nginx

Posted by Ralf Nieuwenhuijsen <ra...@gmail.com>.
My first guess would be that this is related to most browsers not
allowing cross-site scripting. But looking at the log, the request
actually takes place..

You want to make sure, not only to proxy one-way, but also to
reverse-proxy. (that made all the difference for me proxying on
apache2)

Perhaps you should check the javascript-error-console and see if there
is anything there.
Does manually retrieving the list of databases work?

 http://127.0.0.1:5984/_all_dbs

If so, the error has to do with proxying and cross-site-scripting
security of the browser.

Greetings,
Ralf


2008/4/17, Benoit Chesneau <bc...@gmail.com>:
> On Thu, Apr 17, 2008 at 10:20 AM, Benoit Chesneau <bc...@gmail.com> wrote:
>  > Hi,
>  >
>  >   I would like to use couchdb (last trunk) behind nginx so I use this
>  >  configuration :
>  >     server {
>  >           listen        80;
>  >           server_name   couchdb;
>  >             location / {
>  >             proxy_pass http://127.0.0.1:5984;
>  >             proxy_redirect off;
>  >             proxy_set_header   Port             $proxy_port;
>  >             proxy_set_header   X-Real-IP        $remote_addr;
>  >             proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
>  >         }
>  >     }
>  >
>  >   But it doesn't work. I can access to futon, and other pages, but db
>  >   aren't listed and basically I can't do anything on the db. Same result
>  >   whe I use a python script that acess to couchdb via nginx. Is there
>  >   something I missed ? It's really weird anyway.
>  >
>  >   - benoît
>  >
>
>
> couchdb logs :
>
>  http://www.friendpaste.com/xKYcgNLJ
>
> --
>  - benoît
>

Re: problem with couchdb behing nginx

Posted by Benoit Chesneau <bc...@gmail.com>.
On Thu, Apr 17, 2008 at 10:20 AM, Benoit Chesneau <bc...@gmail.com> wrote:
> Hi,
>
>   I would like to use couchdb (last trunk) behind nginx so I use this
>  configuration :
>     server {
>           listen        80;
>           server_name   couchdb;
>             location / {
>             proxy_pass http://127.0.0.1:5984;
>             proxy_redirect off;
>             proxy_set_header   Port             $proxy_port;
>             proxy_set_header   X-Real-IP        $remote_addr;
>             proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
>         }
>     }
>
>   But it doesn't work. I can access to futon, and other pages, but db
>   aren't listed and basically I can't do anything on the db. Same result
>   whe I use a python script that acess to couchdb via nginx. Is there
>   something I missed ? It's really weird anyway.
>
>   - benoît
>

couchdb logs :

http://www.friendpaste.com/xKYcgNLJ
-- 
- benoît