Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 90974 invoked from network); 13 Jan 2011 02:25:32 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 13 Jan 2011 02:25:32 -0000 Received: (qmail 25992 invoked by uid 500); 13 Jan 2011 02:25:31 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 25837 invoked by uid 500); 13 Jan 2011 02:25:30 -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 25829 invoked by uid 99); 13 Jan 2011 02:25:30 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 13 Jan 2011 02:25:30 +0000 X-ASF-Spam-Status: No, hits=3.7 required=10.0 tests=FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of lfeiman888@gmail.com designates 209.85.215.52 as permitted sender) Received: from [209.85.215.52] (HELO mail-ew0-f52.google.com) (209.85.215.52) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 13 Jan 2011 02:25:21 +0000 Received: by ewy23 with SMTP id 23so620130ewy.11 for ; Wed, 12 Jan 2011 18:25:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:reply-to:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=dS+vVHHug7ueuNt5wxeOaGWeKOyPvGsj1eg6cntKudI=; b=n494Mbj1wZvLKg/1q1ZCCldwprKt1x/Xfuf3sxsnFG8SgfBBKskQeeKVr4IX8nDM2W 5ZPmHHW4Kqqig4vhYLnV7afeLDB2xPH0yYjr31CrCW8XGtsAcuuSFARXSdXiTxYD2RcY Xvw4OoMCbEAx0JxGnM1UXv9H+HGaLiFrkPfyY= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:reply-to:in-reply-to:references:date:message-id :subject:from:to:content-type; b=QQ/cb51KnnG3G+d5PLWI5GqjVyKPErIKptcjxUh8Hl5V4IbMtdiQEE73E8H6kNI+xY zKQulfILDv+pYidvsDxbVzM1t4ouIXk/WAIumOGfiTXY7YqSF2XH4OUzmant9h4vb0UW aRvt8G/bFq0l8TXfsghvNDrC/S7oWEmFbGv68= MIME-Version: 1.0 Received: by 10.14.19.66 with SMTP id m42mr1285621eem.1.1294885501445; Wed, 12 Jan 2011 18:25:01 -0800 (PST) Received: by 10.14.122.69 with HTTP; Wed, 12 Jan 2011 18:25:01 -0800 (PST) Reply-To: lfeiman888@gmail.com In-Reply-To: References: Date: Thu, 13 Jan 2011 10:25:01 +0800 Message-ID: Subject: Re: Strange issue with VHosts and rewrites... From: feiman To: user@couchdb.apache.org Content-Type: multipart/alternative; boundary=0016e6d6441d56a70d0499b1060f X-Virus-Checked: Checked by ClamAV on apache.org --0016e6d6441d56a70d0499b1060f Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable unsubscribe 2011/1/11 Janez =C5=A0tupar > Here is the problem I'm currently dabbling around with Sofa (got it from > jchrisa's Github)... To this end I'm reverse engineering it and trying to > get it work in a following scenario: > > The database is hidden behind following VHost: sofa.mycouch -> > /sofa/_design/sofa/_rewrite > > Since I wanted to improve the appearance of the URL's I also did some > modifications to the rewrites, my current configuration is as follows: > > [ > { > "to": "_list/index/recent-posts", > "from": "blog/", > "query": { > "limit": 10, > "descending": true > } > }, > { > "to": "_list/:listname/*", > "from": "list/:listname/*", > "query": { > "limit": 10, > "descending": true > } > }, > { > "to" : "_show/:showname/*", > "from" : "show/:showname/*" > }, > { > "to" : "_update/:updatename/*", > "from" : "update/:updatename/*" > }, > { > "to": "_list/index/recent-posts", > "from": "", > "query": { > "limit": 10, > "descending": true > } > }, > { > "to": "script/*", > "from": "script/*" > }, > { > "to": "style/*", > "from": "style/*" > }, > { > "to": "vendor/*", > "from": "vendor/*" > }, > { > "to": "../../*", > "from": ":db/*" > } > ] > > The last problem I have left is that although everything works (I have > indeed done some modifications to the templates, pathing function, etc.. > nothing relevant to this current issue IMHO). > * > Except* one thing doesn't work as expected ... that is posting comments. = I > have kinda narrowed it down that when the browser sends a new blog post i= t > does PUT to address: '"/sofa/_design/sofa/_rewrite/sofa/spet-nov-post"' > (spet-nov-post is a _id - according to jquery.couch.js) > > While comment gets POST -ed to following URL: > '"/sofa/_design/sofa/_rewrite/sofa/"' > > what happens in the rewriter is following: > > 'PUT' /sofa/_design/sofa/_rewrite/sofa/spet-nov-post {1,1} -> 'PUT' > /sofa/spet-nov-post?db=3Dsofa {1,1} > 'POST' /sofa/_design/sofa/_rewrite/sofa/ {1,1} -> 'POST' > /sofa/_design/..?db=3Dsofa {1,1} > > I blame the following rewrite rule: > { > "to": "../../*", > "from": ":db/*" > } > > What is a mistery to me is why does the first request get rewritten > correctly and the second not? AFAIK the second should come out as: 'POST' > /sofa/?db=3Dsofa {1,1} > > Below are the relevant logs -> The first is from new post creation (the P= UT > request), the other is from comment creation (the POST request). > > *First: > *[Sat, 08 Jan 2011 20:27:40 GMT] [debug] [<0.785.0>] Vhost Target: > '"/sofa/_design/sofa/_rewrite/sofa/spet-nov-post"' > > > [Sat, 08 Jan 2011 20:27:40 GMT] [debug] [<0.785.0>] 'PUT' > /sofa/_design/sofa/_rewrite/sofa/spet-nov-post {1,1} > Headers: [{'Accept',"application/json, text/javascript, */*"}, > {'Accept-Charset',"UTF-8,*"}, > {'Accept-Encoding',"gzip,deflate"}, > {'Accept-Language',"en,sl;q=3D0.7,en-us;q=3D0.3"}, > {'Connection',"keep-alive"}, > {'Content-Length',"169"}, > {'Content-Type',"application/json; charset=3DUTF-8"}, > > > {'Cookie',"AuthSession=3DY291Y2hkYjo0RDI4Qzg3MTqTKp7crPdUFEbZrfJh-EiPaxh2= tA"}, > {'Host',"sofa.mycouch"}, > {'Keep-Alive',"115"}, > {'Referer',"http://sofa.mycouch/show/edit/"}, > {'User-Agent',"Mozilla/5.0 (Windows; U; Windows NT 6.1; sl; > rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12 ( .NET CLR 3.5.30729; > .NET4.0C)"}, > {"X-Requested-With","XMLHttpRequest"}] > > [Sat, 08 Jan 2011 20:27:40 GMT] [debug] [<0.785.0>] OAuth Params: [] > > [Sat, 08 Jan 2011 20:27:40 GMT] [debug] [<0.785.0>] timeout 600 > > [Sat, 08 Jan 2011 20:27:40 GMT] [debug] [<0.785.0>] Successful cookie aut= h > as: "couchdb" > > [Sat, 08 Jan 2011 20:27:40 GMT] [debug] [<0.785.0>] rewrite to > "/sofa/spet-nov-post?db=3Dsofa" > > > [Sat, 08 Jan 2011 20:27:40 GMT] [debug] [<0.785.0>] 'PUT' > /sofa/spet-nov-post?db=3Dsofa {1,1} > Headers: [{'Accept',"application/json, text/javascript, */*"}, > {'Accept-Charset',"UTF-8,*"}, > {'Accept-Encoding',"gzip,deflate"}, > {'Accept-Language',"en,sl;q=3D0.7,en-us;q=3D0.3"}, > {'Connection',"keep-alive"}, > {'Content-Length',"169"}, > {'Content-Type',"application/json; charset=3DUTF-8"}, > > > {'Cookie',"AuthSession=3DY291Y2hkYjo0RDI4Qzg3MTqTKp7crPdUFEbZrfJh-EiPaxh2= tA"}, > {'Host',"sofa.mycouch"}, > {'Keep-Alive',"115"}, > {'Referer',"http://sofa.mycouch/show/edit/"}, > {'User-Agent',"Mozilla/5.0 (Windows; U; Windows NT 6.1; sl; > rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12 ( .NET CLR 3.5.30729; > .NET4.0C)"}, > {"X-Requested-With","XMLHttpRequest"}] > > [Sat, 08 Jan 2011 20:27:40 GMT] [debug] [<0.785.0>] OAuth Params: > [{"db","sofa"}] > > [Sat, 08 Jan 2011 20:27:40 GMT] [debug] [<0.785.0>] timeout 600 > > [Sat, 08 Jan 2011 20:27:40 GMT] [debug] [<0.785.0>] Successful cookie aut= h > as: "couchdb" > > [Sat, 08 Jan 2011 20:27:40 GMT] [debug] [<0.93.0>] DDocProc found for > DDocKey: {<<"_design/sofa">>, > <<"119-09fa3ceca488bfc1852ea48e3a0f0921">>} > > [Sat, 08 Jan 2011 20:27:40 GMT] [debug] [<0.630.0>] OS Process > #Port<0.1421> > Input :: ["reset",{"reduce_limit":true}] > > [Sat, 08 Jan 2011 20:27:40 GMT] [debug] [<0.630.0>] OS Process > #Port<0.1421> > Output :: true > > > > *************************************************************************= ************ > > *Second:* > [Sat, 08 Jan 2011 20:27:56 GMT] [debug] [<0.785.0>] Vhost Target: > '"/sofa/_design/sofa/_rewrite/sofa/"' > > > [Sat, 08 Jan 2011 20:27:56 GMT] [debug] [<0.785.0>] 'POST' > /sofa/_design/sofa/_rewrite/sofa/ {1,1} > Headers: [{'Accept',"application/json, text/javascript, */*"}, > {'Accept-Charset',"UTF-8,*"}, > {'Accept-Encoding',"gzip,deflate"}, > {'Accept-Language',"en,sl;q=3D0.7,en-us;q=3D0.3"}, > {'Cache-Control',"no-cache"}, > {'Connection',"keep-alive"}, > {'Content-Length',"361"}, > {'Content-Type',"application/json; charset=3DUTF-8"}, > > > {'Cookie',"AuthSession=3DY291Y2hkYjo0RDI4QzhCQzqLGFFiyeUSKgz9OniE9_g41buH= oQ"}, > {'Host',"sofa.mycouch"}, > {'Keep-Alive',"115"}, > {'Pragma',"no-cache"}, > {'Referer'," > http://sofa.mycouch/list/post/post-page?startkey=3D%5B%22spet-nov-post%22= %5D > "}, > {'User-Agent',"Mozilla/5.0 (Windows; U; Windows NT 6.1; sl; > rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12 ( .NET CLR 3.5.30729; > .NET4.0C)"}, > {"X-Requested-With","XMLHttpRequest"}] > > [Sat, 08 Jan 2011 20:27:56 GMT] [debug] [<0.785.0>] OAuth Params: [] > > [Sat, 08 Jan 2011 20:27:56 GMT] [debug] [<0.785.0>] timeout 600 > > [Sat, 08 Jan 2011 20:27:56 GMT] [debug] [<0.785.0>] Successful cookie aut= h > as: "couchdb" > > [Sat, 08 Jan 2011 20:27:56 GMT] [debug] [<0.785.0>] rewrite to > "/sofa/_design/..?db=3Dsofa" > > > [Sat, 08 Jan 2011 20:27:56 GMT] [debug] [<0.785.0>] 'POST' > /sofa/_design/..?db=3Dsofa {1,1} > Headers: [{'Accept',"application/json, text/javascript, */*"}, > {'Accept-Charset',"UTF-8,*"}, > {'Accept-Encoding',"gzip,deflate"}, > {'Accept-Language',"en,sl;q=3D0.7,en-us;q=3D0.3"}, > {'Cache-Control',"no-cache"}, > {'Connection',"keep-alive"}, > {'Content-Length',"361"}, > {'Content-Type',"application/json; charset=3DUTF-8"}, > > > {'Cookie',"AuthSession=3DY291Y2hkYjo0RDI4QzhCQzqLGFFiyeUSKgz9OniE9_g41buH= oQ"}, > {'Host',"sofa.mycouch"}, > {'Keep-Alive',"115"}, > {'Pragma',"no-cache"}, > {'Referer'," > http://sofa.mycouch/list/post/post-page?startkey=3D%5B%22spet-nov-post%22= %5D > "}, > {'User-Agent',"Mozilla/5.0 (Windows; U; Windows NT 6.1; sl; > rv:1.9.2.12) Gecko/20101026 Firefox/3.6.12 ( .NET CLR 3.5.30729; > .NET4.0C)"}, > {"X-Requested-With","XMLHttpRequest"}] > > [Sat, 08 Jan 2011 20:27:56 GMT] [debug] [<0.785.0>] OAuth Params: > [{"db","sofa"}] > > [Sat, 08 Jan 2011 20:27:56 GMT] [debug] [<0.785.0>] timeout 600 > > [Sat, 08 Jan 2011 20:27:56 GMT] [debug] [<0.785.0>] Successful cookie aut= h > as: "couchdb" > > [Sat, 08 Jan 2011 20:27:56 GMT] [debug] [<0.785.0>] Minor error in HTTP > request: {bad_ctype, > "Content-Type must be multipart/form-data= "} > --0016e6d6441d56a70d0499b1060f--