Expand description
Host aliases — a host as a name for a mounted controller.
RouterBuilder::host_alias registers
them (the hosts block of app_routes! is the declarative form), and the
server applies them before routing. A request whose host an alias names is
routed as the request for the alias’s target — the aliased mount, then the
host’s captured labels — followed by the request’s own path, unless that
path lies under one of the alias’s shared mounts, which keep their own
paths.
From then on it is that request: Request::path_parts holds the
aliased path, so the router, every middleware and the handler see one
address, and a middleware that re-derives the matched controller with
Router::match_controller gets the one the server dispatched to. An
aliased request is identical, apart from Host, to a request any client
could send to the aliased path directly: an alias adds addresses, never
capabilities.
Structs§
- Host
Alias Error - Why
RouterBuilder::host_aliasrefused an alias. The message names the entry and what is wrong with it;app_routes!returns it from the generatedinit().