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 default field order.

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

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.