pub fn client_ip(
headers: &HeaderMap,
peer: Option<IpAddr>,
config: &Config,
) -> Option<IpAddr>Expand description
In the cloud, the address the proxy in front of us reports (CLIENT_IP_HEADER, by default
CF-Connecting-IP); everywhere else, and when that header is missing or isn’t an address,
the socket’s peer. Self-hosted instances never trust a client-supplied header.
The cloud must only be reachable through Cloudflare for the header to be trustworthy.