Issue #5 resolved
Benoit Chesneau
created an issue

This patch add vhost support to webmachine. Works as discussed on ml :

so you can do

[[cname, "example", ".com"], ["a"], some_resource, []}. [["www", "example", ".com"], ["a"], some_resource, []}.
[['*', "example", ".com"], ["a"], some_resource, []}.

... all rules for path dispatching works.

This also available on the branch vhost f my repo :

Comments (5)

  1. Benoit Chesneau reporter

    Following suggestions of @justinsheehy I modified the patch

    - We now get the value of Hostname diferrently :

    We try first to see if we are behind a proxy by default we test if X-Forwarded-Host is in the headers (default for apache and some others proxy), proxy host header could also be configured in x_forwared_host application environment variable. If we aren't behind a proxy we get Host header. If undefined we return no_host_provided and we will match {'*', "80"} .

    - changing dispatching so now we handle host:port matching. so now we match {HostnameParts, Port} tupple in dispatch.conf. I you put HostnameParts only, {HostnameParts, 80} will be matched :

    {{["example", "com"], 80}, PathSchema, Resource, Options} is equivalent to {["example", "com"], PathSchema, Resource, Options}

    in the same time, if hostname isn't found {'*', "80"} will be matched. To work like path spec, '*' could only be used on the beginning now. Since the catchall part could be interesting if we are on top of hostname (eg. *'), the term catchall with the catchall value is added to binding and could be used using wrq:path_info() .

  2. Log in to comment