diff --git a/src/main.rs b/src/main.rs index a487504..aebcb7f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -131,14 +131,14 @@ impl Router { fn speak_proxy(req: Request, remote_addr: SocketAddr, router: Arc, endpoint: &'static str) -> BoxFut { let mut headers = req.headers().clone(); + // This is the correct client IP, not the IP of the load balancer. + // We're adding it to the headers so that downstream can use it for rate limiting and logging. let forwarded_ip = HeaderValue::from_str(&remote_addr.ip().to_string()) .ok() .unwrap_or(HeaderValue::from_static("127.0.0.1")); headers.insert(HeaderName::from_static("forwarded"), forwarded_ip.clone()); headers.insert(HeaderName::from_static("x-forwarded-for"), forwarded_ip.clone()); - info!("Remote IP: {:?}", remote_addr.ip().to_string()); - Box::new(req.into_body().concat2().map(move |b| { // Builds a BoxedFut to return let request_bytes = b.as_ref();