couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Benoit Chesneau <bchesn...@gmail.com>
Subject Re: Simple rewrite rule help
Date Tue, 26 Apr 2011 20:05:29 GMT
On Tue, Apr 26, 2011 at 10:00 PM, Ryan Ramage <ryan.ramage@gmail.com> wrote:
> Great, and can it be done with one generic rule, with a variable?
>
> something like:
> hostname.com:/${db} = ${db}/_design/app/_rewrite
>

Nope you can't. What you can do is:

:db.hostname.com = :db/_design/app/_rewrite should work.


>
>
> On Tue, Apr 26, 2011 at 1:52 PM, Benoit Chesneau <bchesneau@gmail.com> wrote:
>> On Tue, Apr 26, 2011 at 9:48 PM, Ryan Ramage <ryan.ramage@gmail.com> wrote:
>>> Hello all,
>>>
>>> Can I define rule(s) that looks like this?
>>>
>>> http://hostname.com/db1  ->    /db1/_design/app/_rewrite
>>> http://hostname.com/db2  ->    /db2/_design/app/_rewrite
>>> http://hostname.com/db3  ->    /db3/_design/app/_rewrite
>>>
>>> ... and so on
>>>
>>> or, if that messes up accessing the docs/endpoints, maybe
>>>
>>> http://hostname.com/_db1  ->    /db1/_design/app/_rewrite
>>> http://hostname.com/_db2  ->    /db2/_design/app/_rewrite
>>> http://hostname.com/_db3  ->    /db3/_design/app/_rewrite
>>>
>>>
>>> Notice, the hostname is the same, so I can't use a vhost rule. Also, I
>>> would like to have it on a design doc (so it replicates), or only have
>>> to perform the config once per server.
>>>
>>>
>>> Is that possible? ( using couch 1.1 or greater if that helps)
>>>
>>
>> afaik you can use vhosts rules with a path :
>>
>> hostname.com:/app1 = db1/_design/app/_rewrite
>> hostname.com:/app2 = db2/_design/app/_rewrite
>>
>> On the other hand I doubt you can use the _ here, but you can test.
>>
>> - benoît
>>
>> - benoit
>>
>

Mime
View raw message