couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Benoit Chesneau <>
Subject Re: Vhosting Requirements (was: Re: [jira] Commented: (COUCHDB-230) Add Support for Rewritable URL)
Date Fri, 20 Aug 2010 06:55:43 GMT
On Thu, Aug 19, 2010 at 11:12 PM, Jason Smith <> wrote:
> On Fri, Aug 20, 2010 at 04:02, Paul Davis <>wrote:
>> Still confused. A couchapp developer shouldn't require any sort of
>> configuration because that's not under their control. For a couchapp
>> to be couchappy, its going to be barred from *requiring* such
>> configuration or it'll never work on the wide number of clients that
>> would be expected to host them as Chris points out.
> Indeed. However I think in practice, couch app developers demand that the
> URL looks reasonable. Benoit mentioned that vhost and _rewrite are already
> becoming very popular with developers.

Welll both aren't incompatible. You can totally do today a CouchApp
that will adapt its routing depending if it's behind a vhost or not. 2
possibilities today:

1) Use the rewriter and fix a db path :

/db -> ../..
/db/* -> ../../*

and then use this path as default db path in your app. It will always
work if you run your app behind _rewrite.

2) Detect if path have been rewritten using req.requested_path and
comparing to req.path  in shows, lists, updates function.

Now I reckon /db/_design/ddoc/_rewrite/ is a little ugly and that
would be good to shorten this path. Maybe by using the ini like
suggest jchris I think . Which would be the easiest actually, though
I'm not fan of auto declaration which may cause a security issue
(admin that forgot to logout , user replicating a non trusted
couchapp, ..). Also there will be a limit to the number of apps
possible. I've updated the ticket about these questions.

- benoit

View raw message