Via
The HTTP Via request and response header records each proxy and gateway a message passes through, tracking intermediate protocols and recipients along the forwarding chain.
Usage
Proxies and gateways append an entry to the Via header on both requests and responses, and a proxy appends the entry to every message it forwards. Each entry pairs the protocol version the node received the message with, the received-protocol, and a pseudonym or hostname for the node. The header serves two purposes: loop detection and protocol capability tracking.
When a proxy receives a message containing its own identifier in the Via chain, the proxy detects a forwarding loop and rejects the request. The protocol versions recorded across the chain also tell downstream nodes what HTTP features survived each hop of the path.
The Via header tracks the message path at the protocol level. The Forwarded header serves a different purpose by carrying the original client address, host, and protocol information.
Values
Each Via entry follows the format:
received-protocol received-by
The received-protocol consists of an optional protocol name
and a required version number. When the protocol is HTTP, the
name is often omitted, leaving only the version (e.g., 1.1
instead of HTTP/1.1).
The received-by field contains either the host and optional
port of the intermediary, or a pseudonym representing the
node. Proxies hiding internal topology use a pseudonym such
as edge_1 instead of a real hostname.
An optional comment enclosed in parentheses follows the
received-by field, often identifying the proxy software.
Example
A response passing through two proxies shows both entries in
the Via header, each naming the protocol the node
received the message with. The protocol name is
omitted for HTTP, so 1.1 alone is the conventional form.
Consecutive entries sharing a received-protocol are
allowed to collapse into one.
Via: 1.1 proxy.example.re, 1.1 edge_1
A gateway receiving a request over HTTP/2 before forwarding it onward records the received protocol, so the entry describes the upstream leg rather than the connection the gateway opens next.
Via: 2.0 gateway.example.re
A proxy including a software comment adds the product name in parentheses after the hostname.
Via: 1.1 cache.example.re (Varnish/7)