Skip to main content

extract_client_ip

Function extract_client_ip 

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

Extract a raw client IP assertion using the effective field order.

This delegates to extract_client_ip_with_headers with CLIENT_IP_HEADERS. A missing value in every header returns None. A malformed, duplicate, or non-text value in the first present header returns an error without consulting lower-priority headers.

For Forwarded and X-Forwarded-For, this returns the rightmost address, which is the assertion nearest the server. The result is still untrusted; this function has no transport-peer or trusted-proxy configuration.