diff --git a/examples/gin/main.go b/examples/gin/main.go index 80ef36e..29554c6 100644 --- a/examples/gin/main.go +++ b/examples/gin/main.go @@ -43,6 +43,7 @@ func main() { // Launch a simple server. router := gin.Default() + router.ForwardedByClientIP = true router.Use(middleware) router.GET("/", index) log.Fatal(router.Run(":7777")) diff --git a/examples/http/main.go b/examples/http/main.go index a9e2613..5e4f666 100644 --- a/examples/http/main.go +++ b/examples/http/main.go @@ -39,7 +39,7 @@ func main() { } // Create a new middleware with the limiter instance. - middleware := stdlib.NewMiddleware(limiter.New(store, rate)) + middleware := stdlib.NewMiddleware(limiter.New(store, rate), stdlib.WithForwardHeader(true)) // Launch a simple server. http.Handle("/", middleware.Handler(http.HandlerFunc(index)))