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.
The syntax for Max-Forwards header is as follows:
<number> is a decimal integer indicating the remaining number of times this request message can be forwarded.
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.
Here are some examples of how to use Max-Forwards header.
OPTIONS /index.html HTTP/1.1
TRACE /index.html HTTP/1.1
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.
- After installing ModHeader from the Chrome Web Store, click on its icon in your toolbar to open it.
- In the Request Headers section, click on 'Add' button.
Max-Forwardsin the name field and desired number in the value field. For example, you can set the value to 5.
- 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.