Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 64738 invoked from network); 19 Nov 2010 16:51:43 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 19 Nov 2010 16:51:43 -0000 Received: (qmail 85438 invoked by uid 500); 19 Nov 2010 16:52:13 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 85285 invoked by uid 500); 19 Nov 2010 16:52:12 -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 85277 invoked by uid 99); 19 Nov 2010 16:52:12 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 19 Nov 2010 16:52:12 +0000 X-ASF-Spam-Status: No, hits=0.7 required=10.0 tests=NORMAL_HTTP_TO_IP,SPF_NEUTRAL,WEIRD_PORT X-Spam-Check-By: apache.org Received-SPF: neutral (nike.apache.org: local policy) Received: from [80.244.253.218] (HELO mail.traeumt.net) (80.244.253.218) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 19 Nov 2010 16:52:05 +0000 Received: from dahlia.local (p5799E32D.dip.t-dialin.net [87.153.227.45]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mail.traeumt.net (Postfix) with ESMTPSA id 95BF93C2B6 for ; Fri, 19 Nov 2010 17:51:44 +0100 (CET) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Apple Message framework v1082) Subject: Re: Problem getting simple rewrite rule to work From: Jan Lehnardt In-Reply-To: Date: Fri, 19 Nov 2010 17:51:44 +0100 Content-Transfer-Encoding: quoted-printable Message-Id: <55D35EAA-4DED-4D70-B501-FFEFD7FDBC10@apache.org> References: <9844C269-EEB6-4934-B71C-1E531F9021C8@omnigroup.com> <4B34440B-1BC1-4631-B446-4B04D38DEA46@apache.org> To: user@couchdb.apache.org X-Mailer: Apple Mail (2.1082) X-Virus-Checked: Checked by ClamAV on apache.org Weird. Can you share the full code (As a GitHub repo maybe)? Cheers Jan --=20 On 19 Nov 2010, at 17:06, Timothy Wood wrote: >=20 > Oops! >=20 > I just noticed that on my first two tries, one of the keys in the = rewrite was "from:" instead of "from". Fixing that and using a = rewrites.js of: >=20 > [ > { > "from": "", > "to": "index.html", > "method": "GET" > } > ] >=20 > still doesn't work (with or without the extra 'method' key), sadly. >=20 >=20 > [Fri, 19 Nov 2010 15:59:33 GMT] [debug] [<0.31811.0>] Vhost = Target: '"/tinderbox/_design/app/_rewrite/"' >=20 >=20 > [Fri, 19 Nov 2010 15:59:33 GMT] [debug] [<0.31811.0>] 'GET' = /tinderbox/_design/app/_rewrite/ {1,1} > Headers: = [{'Accept',"application/xml,application/xhtml+xml,text/html;q=3D0.9,text/p= lain;q=3D0.8,image/png,*/*;q=3D0.5"}, > {'Accept-Encoding',"gzip, deflate"}, > {'Accept-Language',"en-us"}, > {'Connection',"keep-alive"}, > {'Host',"tb-test:5984"}, > {'User-Agent',"Mozilla/5.0 (Macintosh; U; Intel Mac OS = X 10_6_5; en-us) AppleWebKit/533.18.1 (KHTML, like Gecko) Version/5.0.2 = Safari/533.18.5"}] >=20 > [Fri, 19 Nov 2010 15:59:33 GMT] [debug] [<0.31811.0>] OAuth = Params: [] >=20 > [Fri, 19 Nov 2010 15:59:33 GMT] [error] [<0.31811.0>] = function_clause error in HTTP request >=20 > [Fri, 19 Nov 2010 15:59:33 GMT] [info] [<0.31811.0>] Stacktrace: = [{couch_httpd_rewrite,'-handle_rewrite_req/3-lc$^1/1-1-', > [<<"[\n\t{\n\t\t\"from\": = \"\",\n\t\t\"to\": \"index.html\"\n\t}\n]">>]}, > {couch_httpd_rewrite,handle_rewrite_req,3}, > {couch_httpd_db,do_db_req,2}, > {couch_httpd,handle_request_int,5}, > {mochiweb_http,headers,5}, > {proc_lib,init_p_do_apply,3}] >=20 > [Fri, 19 Nov 2010 15:59:33 GMT] [info] [<0.31811.0>] 127.0.0.1 - = - 'GET' /tinderbox/_design/app/_rewrite/ 500 >=20 > [Fri, 19 Nov 2010 15:59:33 GMT] [debug] [<0.31811.0>] httpd 500 = error response: > {"error":"unknown_error","reason":"function_clause"} >=20 >=20 > -tim >=20 >=20 >=20 > On Nov 19, 2010, at 4:51 AM, Jan Lehnardt wrote: >=20 >> Hi Tim, >>=20 >> can you try without the empty "query" object? >>=20 >> Cheers >> Jan >> --=20 >>=20 >> On 19 Nov 2010, at 08:39, Timothy Wood wrote: >>=20 >>>=20 >>> I've been having some fun learning CouchDB and have started writing = up a replacement for an simple internal app, as a learning exercise. >>>=20 >>> To make nice URLs, I looked at the notes on the rewrite handler at = and tried to set up my local sandbox to make = rewrites work. But, so far I'm having no luck and I'm not fluent enough = in Erlang to figure out exactly what the error message means. >>>=20 >>> Configuration: >>>=20 >>> couchdb 1.0.1 installed with homebrew on Mac OS X 10.6.5 (using = a couchdb user/group and permissions fixed to be couchdb:couchdb on = various /usr/local dirs for couchdb) >>> =09 >>> App pushed with couchapp. I can access the un-rewritten URL just = fine >>>=20 >>> My /etc/hosts has: >>>=20 >>> 127.0.0.1 tb-test >>>=20 >>> local.ini has these interesting bits: >>>=20 >>> [log] >>> level =3D debug >>>=20 >>> [vhosts] >>> tb-test:5984 =3D /tinderbox/_design/app/_rewrite >>>=20 >>> =09 >>> my app/rewrites.js has exactly the example at the top of = couch_httpd_rewrite's handle_rewrite_req/3 >>>=20 >>> [ >>> { >>> "from:": "", >>> "to": "index.html", >>> "method": "GET", >>> "query": {} >>> } >>> ] >>> =09 >>> when I open http://tb-test:5984/ my log file gets: >>>=20 >>> [Fri, 19 Nov 2010 07:17:59 GMT] [debug] [<0.103.0>] Vhost = Target: '"/tinderbox/_design/app/_rewrite/"' >>>=20 >>>=20 >>> [Fri, 19 Nov 2010 07:17:59 GMT] [debug] [<0.103.0>] 'GET' = /tinderbox/_design/app/_rewrite/ {1,1} >>> Headers: = [{'Accept',"application/xml,application/xhtml+xml,text/html;q=3D0.9,text/p= lain;q=3D0.8,image/png,*/*;q=3D0.5"}, >>> {'Accept-Encoding',"gzip, deflate"}, >>> {'Accept-Language',"en-us"}, >>> {'Connection',"keep-alive"}, >>> {'Host',"tb-test:5984"}, >>> {'User-Agent',"Mozilla/5.0 (Macintosh; U; Intel Mac OS = X 10_6_5; en-us) AppleWebKit/533.18.1 (KHTML, like Gecko) Version/5.0.2 = Safari/533.18.5"}] >>>=20 >>> [Fri, 19 Nov 2010 07:17:59 GMT] [debug] [<0.103.0>] OAuth = Params: [] >>>=20 >>> [Fri, 19 Nov 2010 07:17:59 GMT] [error] [<0.103.0>] = function_clause error in HTTP request >>>=20 >>> [Fri, 19 Nov 2010 07:17:59 GMT] [info] [<0.103.0>] Stacktrace: = [{couch_httpd_rewrite,'-handle_rewrite_req/3-lc$^1/1-1-', >>> [<<"[\n\t{\n\t\t\"from:\": = \"\",\n\t\t\"to\": \"index.html\",\n\t\t\"method\": = \"GET\",\n\t\t\"query\": {}\n\t}\n]">>]}, >>> {couch_httpd_rewrite,handle_rewrite_req,3}, >>> {couch_httpd_db,do_db_req,2}, >>> {couch_httpd,handle_request_int,5}, >>> {mochiweb_http,headers,5}, >>> {proc_lib,init_p_do_apply,3}] >>>=20 >>> [Fri, 19 Nov 2010 07:17:59 GMT] [info] [<0.103.0>] 127.0.0.1 - - = 'GET' /tinderbox/_design/app/_rewrite/ 500 >>>=20 >>> [Fri, 19 Nov 2010 07:17:59 GMT] [debug] [<0.103.0>] httpd 500 = error response: >>> {"error":"unknown_error","reason":"function_clause"} >>>=20 >>>=20 >>> So, it looks like it is finding the rewrite rule, but something = about what I'm going it giving it fits. The error message isn't = particularly helpful =3D) >>>=20 >>> Any suggestions about what I might be doing wrong would be much = appreciated. >>>=20 >>> Thanks! >>>=20 >>> -tim >>>=20 >>>=20 >>=20 >=20