HTTP - Host Header

About

host in the context of HTTP is a header field that:

  • indicates the destination of the request
  • and is part of the origin definition

The Host field value is the network location of the origin server or gateway given by the original URL.

The value is:

Example

Example of a get request to the URL http://www.w3.org/pub/WWW/

GET /pub/WWW/ HTTP/1.1
Host: www.w3.org

Usage

It's used:

  • to route the request to its destination server on the network.
  • to host several domain on the same host (virtual domain)

Virtual Domain

One server (one host) can serve multiple domain thanks to the host header. The web server looks the value up and therefore can change the destination of the request. See What is and how works a virtual host / custom domain / vanity hostnames

Network Route

This value is used (generally with TCP/IP) to route the message to the destination server.

Gateway

It's also used to route the request to the destination website (A server may host several hostname called virtual host)

The http Server uses this value to create optionally virtual host.

On a Apache server for instance, the host value is mapped to the ServerName property of the configuration file in order to route the request to the backend web site.

Set

The host is an header that is set by the client in a request. The client sets it from the value found in the URL.

Documentation / Reference


Powered by ComboStrap