liveBook · Manning

Host header

As explained in Learn Docker in a Month of Lunches, Second Edition

A host header is an HTTP request header that identifies the destination domain or host requested by a client.

A host header identifies the domain requested by an HTTP client. A reverse proxy such as Nginx uses it to choose the site configuration when multiple applications share one port. section 20.1

A local routing workflow uses the host header like this:

  • Send the request to Nginx; its matching server configuration proxies the request to the application container. section 20.1

Routing whoami.local

After adding whoami.local to the hosts file, starting the who-am-I container, and reloading Nginx, curl http://whoami.local reaches the application through the proxy.

How Learn Docker in a Month of Lunches, Second Edition covers it

How deep it goes
Explains domain matching and header forwarding through Nginx, without detailing broader HTTP-header behavior.
Examples
Uses whoami.local, api.numbers.local, curl, and Nginx proxy_set_header configuration.
What it assumes
Uses HTTP requests, a hosts file, Docker containers, and basic Nginx configuration without detailing their internals.
What you can do after
Operate/configure Nginx to preserve the requested host while proxying an application container.
How it connects
Connects HTTP requests with reverse proxies, DNS, Docker networks, and REST APIs.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Learn Docker in a Month of Lunches, Second Edition. The section links point to the parts of the book it draws on.