/
Host

Host

Overview

The <Host> element is used to apply content settings to requests to specific virtual hosts and/or to act as a container for more specific rules based on path or query string.

Host matching is based on exact matching of the hostname in a request, and optionally based on scheme or port. For this matching to be reliable, the hostname must be canonical; that is, it must come from the web server's own virtual host configuration rather than a value in the Host header in an HTTP request. Otherwise any rule can be circumvented trivially.

Apache can support this via the UseCanonicalName directive, but this is normally unnecessary because there are better, more powerful ways of handling content settings in Apache itself.

IIS does not support this at all, and reports to applications only the value provided by the client. This is worked around by means of the <Site> element to provide a canonical site to host mapping independently of IIS.

Reference

Attributes

Content Specifiers

Names

Type

Req?