Skip to content

Commit

Permalink
ingest: correctly process X-Forwarded-For with multiple IPs
Browse files Browse the repository at this point in the history
  • Loading branch information
absorbb committed Jan 3, 2024
1 parent 5d82948 commit 771f252
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion ingest/router.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ func patchEvent(c *gin.Context, messageId string, event *AnalyticsServerEvent, t
return fmt.Errorf("Invalid track event name '%s'. Max length is 64 characters.", eventName)
}
}
ip := utils.NvlString(c.GetHeader("X-Real-Ip"), c.GetHeader("X-Forwarded-For"), c.ClientIP())
ip := strings.TrimSpace(strings.Split(utils.NvlString(c.GetHeader("X-Real-Ip"), c.GetHeader("X-Forwarded-For"), c.ClientIP()), ",")[0])
ev["requestIp"] = ip

ctx, ok := ev["context"].(map[string]any)
Expand Down

0 comments on commit 771f252

Please sign in to comment.