Return-Path: Delivered-To: apmail-incubator-couchdb-dev-archive@locus.apache.org Received: (qmail 60162 invoked from network); 3 Sep 2008 22:46:39 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 3 Sep 2008 22:46:39 -0000 Received: (qmail 17285 invoked by uid 500); 3 Sep 2008 22:46:36 -0000 Delivered-To: apmail-incubator-couchdb-dev-archive@incubator.apache.org Received: (qmail 17244 invoked by uid 500); 3 Sep 2008 22:46:36 -0000 Mailing-List: contact couchdb-dev-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: couchdb-dev@incubator.apache.org Delivered-To: mailing list couchdb-dev@incubator.apache.org Received: (qmail 17233 invoked by uid 99); 3 Sep 2008 22:46:36 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Sep 2008 15:46:36 -0700 X-ASF-Spam-Status: No, hits=3.2 required=10.0 tests=FS_REPLICA,HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of jwall@google.com designates 216.239.33.17 as permitted sender) Received: from [216.239.33.17] (HELO smtp-out.google.com) (216.239.33.17) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 03 Sep 2008 22:45:38 +0000 Received: from zps37.corp.google.com (zps37.corp.google.com [172.25.146.37]) by smtp-out.google.com with ESMTP id m83MiVI8032620 for ; Wed, 3 Sep 2008 23:44:32 +0100 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=google.com; s=beta; t=1220481872; bh=/J1yRTOq8chd7QdVZ9i8Ye9eagw=; h=DomainKey-Signature:Message-ID:Date:From:To:Subject:In-Reply-To: MIME-Version:Content-Type:References; b=wG8cYEuIgFwlEBSGbrE0vTt7KH +ksxRDRRCrdNj6jKEao/+f3hI1u+Tkj6t8qX50oSlAehqHBW1dybNUuG25yA== DomainKey-Signature: a=rsa-sha1; s=beta; d=google.com; c=nofws; q=dns; h=message-id:date:from:to:subject:in-reply-to:mime-version: content-type:references; b=H2X22arnLnYzsvxm5kalVTdmQdSZsunF6MWmMqLsz7+gwu/XDC7fjX8s23o5yXM4T FcPIDM8iJ5zGGsSQ0jXnw== Received: from fg-out-1718.google.com (fgad23.prod.google.com [10.86.55.23]) by zps37.corp.google.com with ESMTP id m83MiOen013631 for ; Wed, 3 Sep 2008 15:44:26 -0700 Received: by fg-out-1718.google.com with SMTP id d23so290404fga.15 for ; Wed, 03 Sep 2008 15:44:24 -0700 (PDT) Received: by 10.187.243.17 with SMTP id v17mr2285807far.77.1220481864020; Wed, 03 Sep 2008 15:44:24 -0700 (PDT) Received: by 10.187.160.11 with HTTP; Wed, 3 Sep 2008 15:44:23 -0700 (PDT) Message-ID: <7c40ded80809031544g37babd5byac6a98d15ebc1825@mail.gmail.com> Date: Wed, 3 Sep 2008 17:44:23 -0500 From: "Jeremy Wall" To: couchdb-dev@incubator.apache.org Subject: Re: URL-decoding reverse proxy breaks remote replication In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_1128_9655807.1220481864015" References: <0D2EE974-228C-4C7E-A4DC-61CF9D9C8A9F@gmail.com> <7c40ded80809031226k19e134c8o56071ca299fe8c89@mail.gmail.com> X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_1128_9655807.1220481864015 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-Disposition: inline Unfortunately the server is only running 2.2.3 and I can't upgrade it so I guess I'm stuck. :-( On Wed, Sep 3, 2008 at 3:03 PM, Adam Kocoloski wrote: > Hi Jeremy, I think Apache added a "nocanon" keyword in 2.2.7+ that's > supposed to pass raw URLs onto the backend. Have you tried that? Best, > > Adam > > > On Sep 3, 2008, at 3:26 PM, Jeremy Wall wrote: > > An Apache reverse proxy also breaks with url encodings. So that's at least >> one other proxy that does it. >> >> On Wed, Sep 3, 2008 at 2:13 PM, Damien Katz wrote: >> >> This is an issue I've been anticipating for a while, which is proxies >>> messing around with the url encoding and causing problems. >>> >>> CouchDB url elements are delimited by slashes, for example "GET >>> db/doc/fileattachment". But any of the elements "db" "doc" or >>> "attachment" >>> could have slashes in them, if slashes are url encoded (%20 I think). >>> So >>> using the slashes requires that the proxies keep the encoding exactly >>> intact, instead of normalizing encoded urls to slashes. >>> >>> I've discussed this a while ago and was advised that proxies shouldn't >>> mess >>> with the URL encodings. So too me, my default position is this to me is a >>> bug in nginx. However, I can be convinced otherwise, if other proxies or >>> tools tend to do the same thing. >>> >>> -Damien >>> >>> >>> On Sep 3, 2008, at 2:38 PM, Adam Kocoloski wrote: >>> >>> Hi, I installed CouchDB behind nginx the other day and noticed that >>> remote >>> >>>> replication didn't work. The problem seems to be that >>>> >>>> a) CouchDB stores the replication history in a local doc with an ID >>>> formed >>>> from the URL-encoded paths to the source and target DBs, >>>> >>>> b) nginx decodes all %2Fs in the URLs it processes, and >>>> >>>> c) couch_httpd chokes on a GET request for the replication history doc >>>> using the decoded URL delivered by nginx. >>>> >>>> My workaround was to encode "/" as "|" in the ID of the replication >>>> history document. It seemed simpler than doing extra special-casing in >>>> couch_httpd to handle decoded "/" characters in replication docIDs, and >>>> I >>>> didn't see any way to turn off URL decoding in nginx. Best, >>>> >>>> Adam >>>> >>>> --- a/trunk/src/couchdb/couch_rep.erl >>>> +++ b/trunk/src/couchdb/couch_rep.erl >>>> @@ -28,6 +28,9 @@ url_encode([H|T]) -> >>>> [H|url_encode(T)]; >>>> H == $_; H == $.; H == $-; H == $: -> >>>> [H|url_encode(T)]; >>>> + % nginx will decode the %2F which makes couch_httpd blow up >>>> + H == $/ -> >>>> + [$||url_encode(T)]; >>>> true -> >>>> case lists:flatten(io_lib:format("~.16.0B", [H])) of >>>> [X, Y] -> >>>> >>>> >>>> >>>> >>>> >>> > ------=_Part_1128_9655807.1220481864015--