couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Davies <>
Subject Re: Rewriting URLs
Date Sat, 04 Jul 2009 23:51:10 GMT
Hi Noah,

On Sat, Jul 04, 2009 at 11:21:04PM +0100, Noah Slater wrote:
> On Sat, Jul 04, 2009 at 03:16:42PM -0700, Chris Anderson wrote:
> > 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.
> I didn't mean to suggest that design documents get to control the parent URI
> space, as this could obviously introduce conflicts. I think a nice approach, as
> Chris suggests, would be split into two levels:
>   * Design document level URI rewriting, but no parent URIs
>   * Server level configuration that rewrites arbitrary URIs
> Do we need these both in the same release? Not sure, but it would be nice!

Just for fun, I made handle_rewrite_req so it can be configured as [httpd]
default_handler.  Chris envisaged a dictionary of app -> ddocs rewrites and
clearly this doesn't do this yet, but it works as a proof-of-concept.


To use:

default_handler = {couch_httpd_rewrite, handle_rewrite_req, {"test_suite_db", "rewrite_test"}}

Any suggestions for what the actual config would look like for mapping domains
and ports to databases and design docs?

I'm thinking something like:

{"", 80, "/"} = {"mydb", "rootapp"}
{"", 80, "/blog"} = {"mydb", "blogapp"}

I think people will probably want some kind of wildcard matching too though.
Anyway, it's early days still, I think at least supporting basic _rewrite is a
big win.

Jason Davies

View raw message