Skip to main content

extract_client_ip_with_headers

Function extract_client_ip_with_headers 

Source
pub fn extract_client_ip_with_headers(
    headers: &HeaderMap,
    sources: &[ClientIpHeader],
) -> Result<Option<IpAddr>, Error>
Expand description

Extract a raw client IP assertion using caller-defined fields and order.

Sources are checked from left to right and the first present value wins. An empty order, or no value in any configured source, returns None. If a source is present but malformed, duplicate, or non-text, its error is returned immediately instead of falling through to another source.

Forwarded and X-Forwarded-For contribute their rightmost address. All results remain raw and untrusted regardless of the chosen order.