Skip to main content

forwarded_caller

Function forwarded_caller 

Source
fn forwarded_caller(headers: &HeaderMap) -> Option<IpAddr>
Expand description

The address the reverse proxy in front of this server saw the request arrive from, for a deployment that has opted into trusting it.

The rightmost X-Forwarded-For element, because a proxy appends: nginx’s proxy_add_x_forwarded_for and an AWS ALB both put the peer they saw at the right-hand end and keep whatever the client sent to its left. The leftmost element is therefore the client’s own text, and reading it is what let a caller send a different value on every request and get a fresh budget against every limiter each time.

None when neither header holds an address: an unparseable value is not a caller’s name, and the TCP peer is.