Skip to main content

Module client_ip

Module client_ip 

Source
Expand description

Deciding which address a request really came from.

X-Forwarded-For is a claim, not a fact: anyone who can reach the port can set it. It is trustworthy only on the hop written by a proxy we control, so the header is consulted only when the immediate peer is a configured trusted proxy, and ignored entirely otherwise. Without that check a per-IP throttle keyed on the header is bypassed by changing one header value.

Structs§

Cidr
An address range trusted to speak for its clients.
TrustedProxies
The proxies whose X-Forwarded-For we believe.

Enums§

TrustedProxyError
Why a trusted-proxy configuration was rejected at startup.

Functions§

forwarded_for
Joins every X-Forwarded-For value on the request, in order.
throttle_key
Collapses an address to the identity a throttle should count.