Return-Path: Delivered-To: apmail-couchdb-user-archive@www.apache.org Received: (qmail 34137 invoked from network); 19 Nov 2010 15:54:29 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 19 Nov 2010 15:54:29 -0000 Received: (qmail 76756 invoked by uid 500); 19 Nov 2010 15:54:59 -0000 Delivered-To: apmail-couchdb-user-archive@couchdb.apache.org Received: (qmail 76538 invoked by uid 500); 19 Nov 2010 15:54:59 -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 76530 invoked by uid 99); 19 Nov 2010 15:54:58 -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 15:54:58 +0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests=NORMAL_HTTP_TO_IP,SPF_HELO_PASS,SPF_PASS,WEIRD_PORT X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of tjw@omnigroup.com designates 198.151.161.1 as permitted sender) Received: from [198.151.161.1] (HELO machop.omnigroup.com) (198.151.161.1) by apache.org (qpsmtpd/0.29) with SMTP; Fri, 19 Nov 2010 15:54:51 +0000 Received: from [10.5.3.51] (vpn.omnigroup.com [198.151.161.6]) by machop.omnigroup.com (Postfix) with ESMTP id 8292B1CD4D904 for ; Fri, 19 Nov 2010 07:54:29 -0800 (PST) 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: Timothy Wood In-Reply-To: <4B34440B-1BC1-4631-B446-4B04D38DEA46@apache.org> Date: Fri, 19 Nov 2010 07:54:29 -0800 Content-Transfer-Encoding: quoted-printable Message-Id: <5D4B1413-DE5F-47E6-9B17-6397439BF689@omnigroup.com> 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 With a rewrites.js of: [ { "from:": "", "to": "index.html", "method": "GET" } ] I get a similar result: [Fri, 19 Nov 2010 15:51:24 GMT] [debug] [<0.31304.0>] Vhost = Target: '"/tinderbox/_design/app/_rewrite/"' [Fri, 19 Nov 2010 15:51:24 GMT] [debug] [<0.31304.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"}] [Fri, 19 Nov 2010 15:51:24 GMT] [debug] [<0.31304.0>] OAuth = Params: [] [Fri, 19 Nov 2010 15:51:24 GMT] [error] [<0.31304.0>] = function_clause error in HTTP request [Fri, 19 Nov 2010 15:51:24 GMT] [info] [<0.31304.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}\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}] [Fri, 19 Nov 2010 15:51:24 GMT] [info] [<0.31304.0>] 127.0.0.1 - = - 'GET' /tinderbox/_design/app/_rewrite/ 500 [Fri, 19 Nov 2010 15:51:24 GMT] [debug] [<0.31304.0>] httpd 500 = error response: {"error":"unknown_error","reason":"function_clause"} Thanks! -tim On Nov 19, 2010, at 4:51 AM, Jan Lehnardt wrote: > 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