🎉 Requestly joins BrowserStack to build the future of application testing. Read more

HTTP Headers

Max Forwards

HTTP Header

The HTTP Max-Forwards request header is used with the TRACE method to limit the number of nodes, typically proxies, that the request passes through.
Its value is an integer representing the maximum number of nodes the request should visit.
At each node, the value is reduced by one, and the TRACE request is forwarded to the next node until the destination is reached or the Max-Forwards value reaches zero.
The request is then sent back, excluding sensitive headers where applicable, as the body of a 200 response.
This mechanism enables the client to see what information is received at each point in the request chain, especially useful for testing or diagnostic purposes, with the Via header being of particular interest.

If the Max-Forwards header is absent in a TRACE request, the node assumes there is no limit on the number of forwards.

Syntax

Max-Forwards: <integer>

Directives

http
Max-Forwards: 0
Max-Forwards: 10

This feature is neither targeted at, nor implemented in, browsers.

How to Modify Header using Requestly

Requestly is a powerful Chrome extension that allows you to modify HTTP headers, including the Max-Forwards header. This is especially useful for testing how your application handles request forwarding limits during development or debugging. Steps to Modify the Max-Forwards Header:

  1. Install and open the Requestly Chrome extension. You can find it on the Chrome Web Store.
  2. Create a new rule: Click on “Create Rule” and choose “Modify Headers” from the list of available rule types.
  3. Add a new header modification:
    • Under “Action”, select “Add” or “Override”.
    • In the “Header Name” field, enter Max-Forwards.
    • In the “Header Value” field, enter the number of forwards you want to set (e.g., 10).
  4. Set the URL condition: Specify the URL or pattern where this header change should apply (e.g., https://your-api.com/*).
  5. Save the rule.

Once set up, Requestly will inject the Max-Forwards: 10 header into all matching requests, allowing you to test how intermediaries and servers handle request forwarding limits and trace or debug routing paths.

Modifying the Max-Forwards header helps you control how many times a request can be forwarded or proxied. This is useful for troubleshooting or ensuring your network devices process requests correctly without infinite loops.