incubator-couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Chris Anderson <>
Subject Re: Rewriting URLs
Date Sat, 04 Jul 2009 22:16:42 GMT
On Sat, Jul 4, 2009 at 3:12 PM, Paul Davis<> wrote:
> On Sat, Jul 4, 2009 at 6:08 PM, Noah Slater<> wrote:
>> Hey Jason,
>> On Sat, Jul 04, 2009 at 10:34:27PM +0100, Jason Davies wrote:
>>> The basic idea is you add a "rewrites": [...] member to your design doc.
>>> This will allow rewriting of any URLs with the prefix mydb/
>>> _design/app/_rewrite.  The "rewrites" member is a list of rewrite rules
>>> of the form {match: ["foo/bar/<var>"], rewrite:["_view/myview",
>>> {startkey: ["<var>"], endkey: ["<var>", {}]}]
>> This is great!
>> Don't let me contribute stop-energy, but I am thinking that if we're going to do
>> this, we might want to go the full way an implement this from the root URI of
>> the whole CouchDB server instead.
>> Best,
>> --
>> Noah Slater,
> We've discussed where to push the URL rewriting previously. The
> biggest argument against a DB wide rewrite scheme is that _design/
> documents could end up stomping on each other pretty easily.
> For reference in case other people are confused, the rewrite
> capabilities would be best used by putting a proxy in front of CouchDB
> that would rewrite all urls to the appropiate CouchDB path.
> Something like:
> Rewrite to

Eventually this could be implemented in CouchDB itself, with a table
to lookup app-rewrites for various subdomains or ports. I think it's
important to limit what the design doc alone can do. Putting something
like a dictionary of app -> ddoc rewrites in config seems like the
right place to modify CouchDB at such a fundamental level.


Chris Anderson

View raw message