Skip to content

Commit 08af455

Browse files
committed
fix: use client ip instead of remote addr in tailscale whois lookups
1 parent 45a88ea commit 08af455

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

internal/middleware/context_middleware.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ func (m *ContextMiddleware) Middleware() gin.HandlerFunc {
7474
uuid, err := c.Cookie(m.runtime.SessionCookieName)
7575

7676
if err == nil {
77-
userContext, cookie, err := m.cookieAuth(c.Request.Context(), uuid, c.RemoteIP())
77+
userContext, cookie, err := m.cookieAuth(c.Request.Context(), uuid, c.ClientIP())
7878

7979
if err == nil {
8080
if cookie != nil {
@@ -112,10 +112,10 @@ func (m *ContextMiddleware) Middleware() gin.HandlerFunc {
112112

113113
// Lastly check if we have a tailscale session to add
114114
if m.tailscale != nil {
115-
tailscaleContext, err := m.tailscaleWhois(c.Request.Context(), c.RemoteIP())
115+
tailscaleContext, err := m.tailscaleWhois(c.Request.Context(), c.ClientIP())
116116

117117
if err != nil {
118-
m.log.App.Error().Err(err).Msgf("Error performing tailscale whois for IP %s: %v", c.RemoteIP(), err)
118+
m.log.App.Error().Err(err).Msgf("Error performing tailscale whois for IP %s: %v", c.ClientIP(), err)
119119
}
120120

121121
if tailscaleContext != nil {

0 commit comments

Comments
 (0)