Skip to content

Commit ba8a1b7

Browse files
committed
fix(honeypot/naive): right, we want the client IP, not the load balancer IP
Signed-off-by: Xe Iaso <me@xeiaso.net>
1 parent 40afc13 commit ba8a1b7

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

internal/honeypot/naive/naive.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66
"fmt"
77
"log/slog"
88
"math/rand/v2"
9-
"net"
109
"net/http"
1110
"net/netip"
1211
"time"
@@ -154,8 +153,7 @@ func (i *Impl) ServeHTTP(w http.ResponseWriter, r *http.Request) {
154153

155154
realIP, _ := internal.RealIP(r)
156155
if !realIP.IsValid() {
157-
host, _, _ := net.SplitHostPort(r.RemoteAddr)
158-
realIP = netip.MustParseAddr(host)
156+
realIP = netip.MustParseAddr(r.Header.Get("X-Real-Ip"))
159157
}
160158

161159
network, ok := internal.ClampIP(realIP)

0 commit comments

Comments
 (0)