Max-Forwards

The HTTP Max-Forwards header is used as a mechanism to limit the number of times that a message can be forwarded by intermediaries for HTTP TRACE and HTTP OPTIONS requests.

Table of Contents

Usage

The Max-Forwards header is used to restrict the number of times that a message can be forwarded. It is only used for HTTP TRACE and HTTP OPTIONS requests. This is useful, for example, when troubleshooting problems in a message chain or locating network loops. The HTTP header is set with an integer value that indicates the number of forwards remaining, at most.

Request

Max-Forwards: <# of forwards remaining>

When an intermediary receives a HTTP response with the HTTP Max-Forwards header, it will remove the HTTP header, decrement the value, and replace the HTTP header with the new one for the next HTTP request. Effectively, this reduces the number of remaining forwards because it counts itself as part of the chain.

Response

Max-Forwards: 3

Request

Max-Forwards: 2

If an intermediary receives a HTTP Max-Forwards header with a value of zero then it can no longer forward the message. Instead, the intermediary must respond to the message with a 200 OK and the original HTTP request as message body.

For any HTTP requests that are not HTTP TRACE or HTTP OPTIONS, any recipient can ignore this HTTP header.

Takeaway

The HTTP Max-Forwards header is a mechanism used for troubleshooting that restricts the number of times that messages can be forwarded under certain circumstances.

See also

Last updated: June 2, 2022