Skip to main content

client_ip

Function client_ip 

Source
pub fn client_ip(peer: IpAddr, headers: &HeaderMap, trusted: &[Cidr]) -> IpAddr
Expand description

The client a request comes from, for rate limiting.

Behind Caddy every peer is Caddy, so X-Forwarded-For names the client, but only a trusted proxy’s is believed: its right-most entry that is not itself a trusted proxy. An unparsable entry there falls back to the peer rather than reading further left, where the client writes.