Skip to main content

remove_forwarding_metadata_request_headers

Function remove_forwarding_metadata_request_headers 

pub fn remove_forwarding_metadata_request_headers(headers: &mut HeaderMap)
Available on crate features http and std only.
Expand description

Remove request headers that describe the forwarding chain or client address.

Unlike hop-by-hop headers, these fields are normally preserved or appended to by intermediaries. Remove them explicitly when crossing a trust boundary or before deriving fresh forwarding metadata. This includes Forwarded, Via, the X-Forwarded-* family, and common client-IP aliases.

This function only modifies the supplied header map. Forwarding information already parsed into request extensions is unaffected.