Max-Forwards Header

Table of Content

The Max-Forwards header field provides a mechanism with the TRACE and OPTIONS methods to limit the number of proxies or gateways that can forward the request to the next inbound server. This can be useful when the client is attempting to trace a request chain which appears to be failing or looping in mid-chain.

Syntax

The syntax for Max-Forwards header is as follows:

Max-Forwards: <number>

The <number> is a decimal integer indicating the remaining number of times this request message can be forwarded.

Directives

The only directive for Max-Forwards header is a non-negative integer. It can be set to any value between 0 and 255. 0 means not to be forwarded at all.

Examples

Here are some examples of how to use Max-Forwards header.

OPTIONS /index.html HTTP/1.1
Max-Forwards: 5
TRACE /index.html HTTP/1.1
Max-Forwards: 0

Browser Compatibility

Browser Compatibility
Chrome Not Supported
Firefox Not Supported
Safari Not Supported
Opera Not Supported
Edge Not Supported

As of current browser standards, the Max-Forwards header is not supported directly by any browser.

How to modify Max-Forwards header

The ModHeader Chrome extension can be used to modify HTTP request headers like Max-Forwards.

  1. After installing ModHeader from the Chrome Web Store, click on its icon in your toolbar to open it.
  2. In the Request Headers section, click on 'Add' button.
  3. Enter Max-Forwards in the name field and desired number in the value field. For example, you can set the value to 5.
  4. Now all requests coming from your chrome browser will have Max-Forwards header set to 5.

This is useful in situations where you need to limit the number of proxies that can forward the request. On the other hand, this feature can also be used for debugging purposes when trying to trace the request chain.