From 2f654419819db1bb579df3eb7572d54c5f26f758 Mon Sep 17 00:00:00 2001 From: Marc Vertes Date: Tue, 27 Apr 2021 15:39:57 +0200 Subject: [PATCH] Enable benchHandler on "/bench/" in addition of "/bench" Adding the trailing slash allows to trigger the bench handler for performance measurements in situations where a trailing slash character '/' is added to the request. For example, in traefik addPrefix middleware, if you specify a "/bench" prefix, a request on "http://localhost" will be transformed from "GET /" to "GET /bench/" with no way to remove the trailing '/' (at least without adding another rewrite rule, which would modify measurements). --- app.go | 1 + 1 file changed, 1 insertion(+) diff --git a/app.go b/app.go index dc4fdf9..79232d8 100644 --- a/app.go +++ b/app.go @@ -53,6 +53,7 @@ func main() { http.HandleFunc("/data", dataHandler) http.HandleFunc("/echo", echoHandler) http.HandleFunc("/bench", benchHandler) + http.HandleFunc("/bench/", benchHandler) http.HandleFunc("/", whoamiHandler) http.HandleFunc("/api", apiHandler) http.HandleFunc("/health", healthHandler)