Skip to content

Commit

Permalink
Fixed remote addr (on Caddy reverse proxy) problem
Browse files Browse the repository at this point in the history
  • Loading branch information
jonirrings committed Dec 3, 2024
1 parent 87a43ff commit f8681d7
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/http/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,8 @@ fn clear_path_end_slash(input: &str) -> &str {
fn trust_addr_proxy(headers : &HashMap<String,String>,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()
}
Expand Down

0 comments on commit f8681d7

Please sign in to comment.