Host Header

Host Header

The Host header is the only header where RFC 9112 explicitly mandates a 400 response for violations. This makes the Host header tests the strictest in the entire suite — close or timeout is NOT acceptable.

The Rule

“A server MUST respond with a 400 (Bad Request) status code to any HTTP/1.1 request message that lacks a Host header field and to any request message that contains more than one Host header field line or a Host header field with an invalid field value.” — RFC 9112 Section 3.2

This single sentence covers three violations:

  1. Missing Host header
  2. More than one Host header line (duplicate)
  3. Host header with an invalid field value

Tests