couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Timothy Wood <>
Subject Problem getting simple rewrite rule to work
Date Fri, 19 Nov 2010 07:39:28 GMT

I've been having some fun learning CouchDB and have started writing up a replacement for an
simple internal app, as a learning exercise.

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.


	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)
App pushed with couchapp.  I can access the un-rewritten URL just fine <>

My /etc/hosts has: tb-test

local.ini has these interesting bits:

	level = debug

	tb-test:5984 = /tinderbox/_design/app/_rewrite

my app/rewrites.js has exactly the example at the top of couch_httpd_rewrite's handle_rewrite_req/3

			"from:": "",
			"to": "index.html",
			"method": "GET",
			"query": {}
when I open http://tb-test:5984/ my log file gets:

	[Fri, 19 Nov 2010 07:17:59 GMT] [debug] [<0.103.0>] Vhost Target: '"/tinderbox/_design/app/_rewrite/"'

	[Fri, 19 Nov 2010 07:17:59 GMT] [debug] [<0.103.0>] 'GET' /tinderbox/_design/app/_rewrite/
	Headers: [{'Accept',"application/xml,application/xhtml+xml,text/html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5"},
	          {'Accept-Encoding',"gzip, deflate"},
	          {'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 07:17:59 GMT] [debug] [<0.103.0>] OAuth Params: []

	[Fri, 19 Nov 2010 07:17:59 GMT] [error] [<0.103.0>] function_clause error in HTTP request

	[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]">>]},

	[Fri, 19 Nov 2010 07:17:59 GMT] [info] [<0.103.0>] - - 'GET' /tinderbox/_design/app/_rewrite/

	[Fri, 19 Nov 2010 07:17:59 GMT] [debug] [<0.103.0>] httpd 500 error response:

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 =)

Any suggestions about what I might be doing wrong would be much appreciated.



View raw message