couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Davis <paul.joseph.da...@gmail.com>
Subject Re: Rewriting URLs
Date Sat, 04 Jul 2009 22:20:56 GMT
On Sat, Jul 4, 2009 at 6:16 PM, Chris Anderson<jchris@apache.org> wrote:
> On Sat, Jul 4, 2009 at 3:12 PM, Paul Davis<paul.joseph.davis@gmail.com> wrote:
>> On Sat, Jul 4, 2009 at 6:08 PM, Noah Slater<nslater@apache.org> 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, http://tumbolia.org/nslater
>>>
>>
>> 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 http://blog.mydomain.com/ to
>> http://127.0.0.1:5984/my_blog_db/_design/sofar/_rewrite/
>>
>
> 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
>

That sounds like a good compromise. The biggest issue I remember was
that replicating in a _design doc could start trouncing things, if it
requires an admin to specify a config it'd place rewrite conflicts in
the 'admin needs to know what he's doing' domain which is fine by me.

>
>
> --
> Chris Anderson
> http://jchrisa.net
> http://couch.io
>

Mime
View raw message