Via
The HTTP Via header is included to provide information about how a message has been routed through the network.
Usage
The HTTP Via header is added by proxy servers and can be present in both HTTP requests and responses. It is used to maintain a list of message forwards, which can help to avoid re-visiting the same node and creating a network loop. Because the HTTP Via header can store protocol information, it can also be used to track the capabilities and support for different protocols inside the network.
The directives for the HTTP Via header are protocol-name
, protocol-version
, host
, port
, and alias
.
The protocol-name
directive is optional and may contain values such as HTTP and HTTPS. In the case of HTTP/1.1, the name is HTTP and the protocol-version
is 1.1.
The host
directive refers to the public proxy URL, which may be accompanied by a port
. The alias
refers to the name of an internal proxy.
Example
In this example, there are two proxies. The first is proxy.example.re
and it uses HTTP/1.1. The second is called edge_1
and also uses version 1.1
of the protocol.
Via: HTTP/1.1 proxy.example.re, 1.1 edge_1
Takeaway
The HTTP Via header is used to maintain a list of proxy servers that the message passes through. The intermediaries are responsible for adding and modifying the HTTP header.