Expand description
Trusted proxies and the ClientIp extractor.
Forwarding headers are honored only when the TCP peer is a trusted proxy, so a client
cannot spoof its address by sending X-Forwarded-For itself.
Structs§
- Client
Ip - The real client address, resolved safely. Needs
TrustedProxiesas a request extension (Appinstalls it) and connect info (App::servedoes); without them it is the peer orNone. - Trusted
Proxies - Set of proxy addresses (IPs and CIDR ranges) allowed to speak for the client. Empty trusts nobody.
Functions§
- ip_
bucket - Rate-limit bucket for a client: the address for IPv4 (and IPv4-mapped IPv6), the /64 prefix for IPv6, because one subscriber usually owns a whole /64 and could otherwise rotate addresses to dodge limits.