couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Adam Kocoloski (JIRA)" <>
Subject [jira] Commented: (COUCHDB-855) New host manager
Date Thu, 24 Feb 2011 15:25:38 GMT


Adam Kocoloski commented on COUCHDB-855:

Hi Benoit, I have a couple of comments:

1) Use fun ?MODULE:config_change/2 instead of fun config_change/2.  I think the latter is
just syntactic sugar for fun(A,B) -> config_change(A,B) end, so it doesn't get the benefit
of using the export table.

2) Is the reordering of entries in significant?  I'd be very careful with
that.  I don't think the order in the .ini file generally matches the output of couch_config:get("daemons"),
and the output of that call is what ultimately determines the daemon startup order.  If you
need to guarantee that the vhost server starts before httpd does you may need to do something

3) I don't see any reason for this server to be trapping exit signals.  Suggest removing that

Cheers, Adam

> New host manager
> ----------------
>                 Key: COUCHDB-855
>                 URL:
>             Project: CouchDB
>          Issue Type: Improvement
>    Affects Versions: 1.1, 1.2
>            Reporter: Benoit Chesneau
>            Assignee: Benoit Chesneau
>            Priority: Blocker
>             Fix For: 1.1, 1.2
>         Attachments: 0001-Squashed-commit-of-the-following.patch, 0001-fix-COUCHDB-855-.-now-the-gen_server-is-only-used-to.patch,
0001-fix-COUCHDB-855-.-now-the-gen_server-is-only-used-to.patch, 0001-fix-COUCHDB-855-.-now-the-gen_server-is-only-used-to.patch,
COUCHDB-855-1.patch, COUCHDB-855-2.patch, COUCHDB-855_20110224-1.patch, COUCHDB-855_20110224-1.patch
> New vhost manager. allows dynamic add of vhosts without restart, wildcard in vhost and
specific functions in erlang by kind of domain. It also fix issue in etap test (160) .
> Find attached to this ticket the patch. It is also available in my github repo :
> more details :
> This gen_server keep state of vhosts added to the ini and try to
> match the Host header (or forwarded) against rules built against
> vhost list. 
> Declaration of vhosts take place in the configuration file :
> [vhosts]
> = /example
> * = /example
> The first line will rewrite the rquest to display the content of the
> example database. This rule works only if the Host header is
> '' and won't work for CNAMEs. Second rule on the other hand
> match all CNAMES to example db. So or
> will work.
> The wildcard ('*') should always be the last in the cnames:
>      "* = /"  will match all cname on top of db
> examples to the root of the machine. (for now no rewriting is
> possible).
> By default vhosts redirection is handle by the function
> couch_httpd_vhost:redirect_to_vhost, but you could pass per vhost a
> specific function :
>      "*" = {Module, Func}"
> The function take the Mochiweb Request object and should return a new
> Mochiweb Request object.
> You could also change the default function to handle request by
> changing the setting `redirect_vhost_handler` in `httpd` section of
> the Ini:
>       [httpd]
>       redirect_vhost_handler = {Module, Fun}
> The function take 2 args : the mochiweb request object and the target
> path. 

This message is automatically generated by JIRA.
For more information on JIRA, see:


View raw message