diff --git a/src/webserver.go b/src/webserver.go index dcec8eb5..1d91caa8 100644 --- a/src/webserver.go +++ b/src/webserver.go @@ -101,8 +101,14 @@ func runWebServer() { ) }) - // Disable proxy feature of gin - _ = router.SetTrustedProxies(nil) + // Set proxy feature of gin + trustedProxies := getEnv("GIN_TRUSTED_PROXIES", "") + if len(trustedProxies) > 0 { + _ = router.SetTrustedProxies(strings.Split(trustedProxies, ",")) + log.Print(strings.Split(trustedProxies, ",")) + } else { + _ = router.SetTrustedProxies(nil) + } // Set the ping endpoint router.GET("/ping", func(c *gin.Context) {