I have my web site run out of a Couch DB instance, so I have my vhost configured to point to /dbname/_design/app/_rewrite
.
I want to be able to access the index page from a web browser, while still accessing the Couch DB API over Ajax, so I set up a pair of rewrite rules in my rewrites
field:
[ { "from": "/dbname/*", "to: ../../*" },
{ "from": "/*", "to: *" } ]
These rules work fine: I can access individual documents through a /dbname/docname
URL, and I can point my web browser at the root of the site and access my attachments that way.
I'd now like to access the information on the database itself, in order to pass a since
parameter to the _changes
API.
/dbname/
works fine/dbname/?name=value
doesn't redirect properly. In the Couch DB log, I see lines like'GET' /dbname/_design/..?name=value 404
, whereas I'd expect to see'GET' /dbname/?name=value 200
.
The second case is needed for Ajax from IE, where the jquery.couch.js
code adds a fake query string to avoid caching.
How can I phrase my rewrite rules so that Couch DB rewrites /dbname/?name=value
correctly?
Edit: To clarify, query strings work OK as long as there is something after the last / in the URL.
/dbname/docname?rev=xxx
works/dbname/_changes?since=1
works/dbname/?_=dummy
doesn't work; it rewrites to/dbname/_design/..?_=dummy