Skip to main content

extract_header_x_forwarded_for

Function extract_header_x_forwarded_for 

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

Extract all X-Forwarded-For field lines as an untrusted asserted IP chain.

Addresses are returned in field order, from the remotest assertion to the one nearest the server. A missing field returns None. Repeated field lines are accepted in wire order, but a non-text line, empty comma-separated item, or invalid IP/socket-address item returns an error. Values are syntactically parsed only; no sender is authenticated and parsing does not make them trustworthy. A feature-gated crate::extract_client_ip convenience can select from this and other fields, but it does not authenticate the sender; establish trust out-of-band before using the result for a security decision.