Skip to main content

extract_header_forwarded_for

Function extract_header_forwarded_for 

Source
pub fn extract_header_forwarded_for(
    headers: &HeaderMap,
) -> Result<Option<Vec<IpAddr>>, Error>
Expand description

Extract RFC 7239 Forwarded for= values as an untrusted IP chain.

Addresses are returned in wire order, from the remotest assertion to the one nearest the server. A missing field returns None; an empty field is invalid. Parsing does not make any address trustworthy. This crate’s strict profile requires exactly one field line and exactly one usable IP for= parameter in every element. Duplicate or non-text field lines, malformed syntax, missing for, duplicate parameters, and unknown, obfuscated, or non-IP nodes return an error. They are never skipped because doing so would change the chain’s meaning. Other valid parameters are parsed only enough to preserve element boundaries and are not returned. Establish an out-of-band proxy trust policy before using the chain for a security decision.