HTTP Forwarded Parser

Parse RFC 7239 Forwarded elements into ordered parameter lists without inferring proxy trust or validating addresses.

Description

Forwarded records proxy-chain information in comma-separated elements with parameters such as for, by, host and proto.

Forwarded records proxy-chain information in comma-separated elements with parameters such as for, by, host and proto. Syntax alone does not establish a trusted client address.1, 2

Parse RFC 7239 Forwarded elements into ordered parameter lists without inferring proxy trust or validating addresses.

When to use HTTP Forwarded Parser

Use this tool to parse RFC 7239 Forwarded elements into ordered parameter lists without inferring proxy trust or validating addresses.

Prepare the header field value, cookie records or status code requested. Supply field values without a header-name prefix and preserve syntax for the parser to inspect.

How to use HTTP Forwarded Parser and understand its results

  1. Prepare the header field value, cookie records or status code requested. Supply field values without a header-name prefix and preserve syntax for the parser to inspect.
  2. Enter header using the field table and calculation rules, then run the tool.
  3. Read elements. The explanation below defines the units, signs, ordering and any flags or placeholder values.
  4. If the tool reports an input issue, correct the values and run it again. Apply the stated assumptions when interpreting a successfully returned result.
Input fieldMeaningValue type; see rules belowRequirement
headerForwarded field value.string; maximum length: 1000000Required

Paste the field value. Split outside quotes/angle brackets, require nonempty elements and valid name=value parameters, lowercase names, unquote values and remove quoted-pair escaping. Reject duplicate normalized names within an element; the same name in separate elements is allowed. Return ordered parameter lists.3

elements=comma groups of ordered semicolon-separated parameters

Units, indexing, boundary conditions and exceptional cases are defined in the calculation rules above.

Output fieldMeaningValue type
elementsForwarded elements in field order.list of list of object; minimum entries: 0; maximum entries: 100000; minimum entries: 0; maximum entries: 100000
json
{
  "input": {
    "header": "for=192.0.2.60;proto=https, for=\"[2001:db8::1]:4711\""
  },
  "output": {
    "elements": [
      [
        {
          "name": "for",
          "value": "192.0.2.60"
        },
        {
          "name": "proto",
          "value": "https"
        }
      ],
      [
        {
          "name": "for",
          "value": "[2001:db8::1]:4711"
        }
      ]
    ]
  }
}

Limitations and assumptions

No proxy trust, IP validity, address decoding, protocol correctness or actual network path is verified. Unknown parameter names are retained.

Numeric inputs must be finite. Follow the calculation-specific rules for overflow, underflow and exceptional cases. Extremely large text inputs are rejected. Missing required fields, extra fields, wrong value types and violations of the calculation rules are input errors.

Alternative or Complementary methods

Use HTTP Link Header Parser: Parse RFC 8288 link targets and parameters while retaining quoted delimiters and repeated relation parameters. For a complementary task, use HTTP Header Name Normalizer: Validate an HTTP field name as an RFC token and convert it to lowercase for case-insensitive lookup.

Further background: RFC 7239: Forwarded HTTP Extension.

References

  1. HTTP Forwarded Parser — tool.io

  2. RFC 7239: Forwarded HTTP Extension — Internet Engineering Task Force

  3. HTTP Content-Type Parser — tool.io

Similar or alternative tools

  • HTTP Link Header Parser

    Parse RFC 8288 link targets and parameters while retaining quoted delimiters and repeated relation parameters.

  • HTTP Header Name Normalizer

    Validate an HTTP field name as an RFC token and convert it to lowercase for case-insensitive lookup.

Don't forget to set a bookmark for tool.io!
Privacy | Imprint | Cookies