From cf6a81200466292397a39ef9031b23237645d63c Mon Sep 17 00:00:00 2001 From: jbergner Date: Wed, 18 Jun 2025 12:37:32 +0200 Subject: [PATCH] debug --- main.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index e791a33..5d5a7cd 100644 --- a/main.go +++ b/main.go @@ -247,6 +247,8 @@ func handleDashboardJSON(w http.ResponseWriter, r *http.Request) { func getClientIP(r *http.Request) string { xff := r.Header.Get("X-Forwarded-For") + xrip := r.Header.Get("X-Real-Ip") + log.Printf("X-Forwarded-For: %s, X-Real-Ip: %s, RemoteAddr: %s", xff, xrip, r.RemoteAddr) if xff != "" { parts := strings.Split(xff, ",") ip := strings.TrimSpace(parts[0]) @@ -254,7 +256,7 @@ func getClientIP(r *http.Request) string { return ip } } - xrip := r.Header.Get("X-Real-Ip") + if xrip != "" && isValidIP(xrip) { return xrip }