Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 1372 invoked from network); 12 Jun 2009 14:05:08 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 12 Jun 2009 14:05:08 -0000 Received: (qmail 16704 invoked by uid 500); 12 Jun 2009 14:05:19 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 16660 invoked by uid 500); 12 Jun 2009 14:05:19 -0000 Mailing-List: contact user-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@couchdb.apache.org Delivered-To: mailing list user@couchdb.apache.org Received: (qmail 16650 invoked by uid 99); 12 Jun 2009 14:05:19 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 12 Jun 2009 14:05:19 +0000 X-ASF-Spam-Status: No, hits=2.7 required=10.0 tests=FS_REPLICA,NORMAL_HTTP_TO_IP,SPF_PASS,WEIRD_PORT X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of adam.kocoloski@gmail.com designates 74.125.92.27 as permitted sender) Received: from [74.125.92.27] (HELO qw-out-2122.google.com) (74.125.92.27) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 12 Jun 2009 14:05:08 +0000 Received: by qw-out-2122.google.com with SMTP id 5so1171253qwd.29 for ; Fri, 12 Jun 2009 07:04:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:message-id:from:to :in-reply-to:content-type:content-transfer-encoding:mime-version :subject:date:references:x-mailer; bh=q6do9YrroILDs3wIcWxsnwfhSLy5IR96z5KDAWCMpAw=; b=Pm6sIBjIbqlPy1LWA7cnc2YxWmqibb465ZM6g6J2TYppDia3rIH5zPwuGGKiIbeGtd zChfg9u/FPG3UvC07UX0vTrevIyIk8amnXfcdV5bWd2FWOHKu7Jpp5tXUW7fww8jM1oJ d+BQ4y1K1fHiJr9ozjGHBaU8H2/bGEwWfo1Zs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:message-id:from:to:in-reply-to:content-type :content-transfer-encoding:mime-version:subject:date:references :x-mailer; b=wVgbk050dsbx5upw9w7IQyFjFa+yfjn0u9YtxcE6U00/h4HZ1Vcszwe67ALnywYKCF uq+7+VeLRb/k9JUKxJYJinv2azW1N1l0JcogSM0pP6vyR6iUmg/YEIt0oKJmThHHTbeY cM0ymwJExXMwrbEdwK7xoOCPm0G7c2N6606bk= Received: by 10.224.11.143 with SMTP id t15mr4348983qat.18.1244815487127; Fri, 12 Jun 2009 07:04:47 -0700 (PDT) Received: from ?10.0.1.2? (c-66-31-20-188.hsd1.ma.comcast.net [66.31.20.188]) by mx.google.com with ESMTPS id 7sm1576794qwf.19.2009.06.12.07.04.41 (version=TLSv1/SSLv3 cipher=RC4-MD5); Fri, 12 Jun 2009 07:04:42 -0700 (PDT) Sender: Adam Kocoloski Message-Id: <2BEE857F-B789-46D8-941F-845EAE77DE35@apache.org> From: Adam Kocoloski To: user@couchdb.apache.org In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed; delsp=yes Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Apple Message framework v935.3) Subject: Re: problem with replication + nginx proxy Date: Fri, 12 Jun 2009 10:04:39 -0400 References: X-Mailer: Apple Mail (2.935.3) X-Virus-Checked: Checked by ClamAV on apache.org On Jun 12, 2009, at 6:03 AM, Benoit Chesneau wrote: > Hi all, > > I'm trying to replicate a source database behind a nginx proxy. All > docs seem replicated in target db but replication never ending. > > Configuration of nginx is : > server { > listen 88.191.73.9:80; > server_name nymphormation.org www.nymphormation.org; > > location / { > proxy_pass http://127.0.0.1:5985; > proxy_redirect default; > proxy_set_header X-Orig-Host '$host:$server_port'; > > if ($request_uri ~* "^/$") { > rewrite ^/$ > = http://nymphormation.org/n/_design/nymphormation/_list/links/news?limit=3D= 11&descending=3Dtrue > permanent; > } > } > > location ~ ^/robots.txt { > root /home/nymphormation/www; > } > > } > > To reproduce I just do a simple replication of > http://nymphormation.org/n to a local db. Could the problem appear due > to rewriting of / ? > > > > - beno=EEt Hi Benoit, the error occurs when the replicator tries to POST to =20 _ensure_full_commit on nymphormation.org. This POST has no body and =20 no Content-Length header, which drives nginx batty. The response that =20= comes back from your server is > > 411 Length Required > >

411 Length Required

>
nginx/0.7.41
> > and the replicator chokes on that because it's expecting JSON. I =20 think nginx is being overly strict here; HTTP/1.1 does not require a =20 Content-Length header, especially for empty request bodies. In my opinion this is a bug in nginx, not Couch. It's particularly =20 annoying when working in Erlang because the inets HTTP client actually =20= _strips off_ the Content-Length header if no body is present. I'm a =20 bit confused, though, because the nginx changelog = (http://nginx.net/CHANGES=20 ) indicates that as of 0.7.25 POSTs do not require a Content-Length. There are a few things we could do in Couch, including a) manually =20 adding the Content-Length : 0 header to the request and b) not letting =20= ourselves get stuck in an infinite receive when ensure_full_commit =20 fails like this. The latter we should definitely do; I'm ambivalent =20 about the former. Best, Adam