basho / webmachine (http://webmachine.basho.com/)
A REST-based system for building web applications.
| commit 82: | ab37abfaf7ad |
| parent 81: | 15cd6ed98abc |
| child 83: | d34f3983bc66 |
host-based dispatching
dispatch rules can now take two different forms:
The old form: {PathMatchSpec, Module, Paramters}
The new form: {HostMatchSpec, [{PathMatchSpec, Module, Parameters}]}
The former is equivalent to the latter with HostMatchSpec={['*'],'*'}
HostMatchSpec is matched against one of (in order of preference):
X-Forwarded-For, X-Forwarded-Host, X-Forwarded-Server, Host
HostMatchSpec can have two forms:
{[HostPart], PortSpec}
or
[HostPart]
The latter is equivalent to the former with PortSpec='*'
The list of host parts is matched against the hostname extracted from a header in much the same way that PathMatchSpec is matched against the path.
Examples:
{[], root_resource, [x]}.
{['*'], [{[], root_resource, [x]}]}.
{{['*'],'*'}, [{[], root_resource, [x]}]}.
Will each match the root path of any host.
{["example","com"], [{[], root_resource, [x]},
{["static"], static_resource, [y]}]}.
Will dispatch the root of example.com to root_resource and example.com/static to static_resource.
{['*',"example","com"], [{[], root_resource, [x]},
{["static"], static_resource, [y]}]}.
Will do the same as above, but also for any subdomains of example.com.
{{[host,"local"], 8000}, [{[], res_A, [x]}]}.
{{[host,"local"], 8001}, [{[], res_B, [x]}]}.
Will dispatch requests to ?.local:8000/ to res_A and requests to ?.local:8001/ to resB, binding the host part immediately preceeding ".local" to 'host', such that wrq:get_path_info(host, ReqData) would return the matched string.
9 months ago
NB: This is not the latest revision. For the latest view, go to tip.
| filename | size | last modified | ||
|---|---|---|---|---|
| demo | ||||
| deps | ||||
| docs | ||||
| ebin | ||||
| include | ||||
| priv | ||||
| scripts | ||||
| src | ||||
| trace | ||||
| www | ||||
| .hgignore | 131 B | 15 months ago | Add .hgignore | |
| .hgtags | 448 B | 11 months ago | Added tag webmachine-1.4 for changeset 616b08c30b4c | |
| Emakefile | 91 B | 17 months ago | initial import | |
| LICENSE | 9.9 KB | 17 months ago | initial import | |
| Makefile | 503 B | 13 months ago | make edoc run the preprocessor so it can handle… | |
| THANKS | 217 B | 11 months ago | via Dave Smith: add modules to .app | |
| start-dev.sh | 109 B | 16 months ago | re-added reloaded startup option | |
| start.sh | 97 B | 17 months ago | initial import |
