Skip to main content

extract_proxy_client_ip

Function extract_proxy_client_ip 

Source
pub fn extract_proxy_client_ip<B>(
    request: &Request<B>,
) -> Result<Option<IpAddr>, Error>
Expand description

Extract a proxy-aware client IP, falling back to the socket peer.

This first applies extract_client_ip to the request Headers. Only when every Header in CLIENT_IP_HEADERS is absent does it fall back to extract_socket_ip. A malformed, duplicate, or non-text first-present Header returns an error without consulting the peer.

Header-derived addresses remain raw assertions. Use this function only when the deployment restricts access to trusted proxies that remove or overwrite every supported client-IP Header. This function does not verify trusted proxy addresses or CIDRs.