From f8681d7a9370dcf38feafc80556ec69eedc7a663 Mon Sep 17 00:00:00 2001 From: Jonir Rings Date: Tue, 3 Dec 2024 15:22:51 +0800 Subject: [PATCH] Fixed remote addr (on Caddy reverse proxy) problem --- src/http/request.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/http/request.rs b/src/http/request.rs index 1eb9a81..4990f3e 100644 --- a/src/http/request.rs +++ b/src/http/request.rs @@ -282,6 +282,8 @@ fn clear_path_end_slash(input: &str) -> &str { fn trust_addr_proxy(headers : &HashMap,remote_addr : &str) -> String { if let Some(remote_ip) = headers.get("X-Real-IP") { remote_ip.to_string() + } else if let Some(remote_ip) = headers.get("X-Real-Ip") { + remote_ip.to_string() } else { remote_addr.to_string() }