From 49f977ea45232fad7fb483f2c9fe474f8059d65a Mon Sep 17 00:00:00 2001 From: Gabe Kangas Date: Mon, 18 Jul 2022 11:08:49 -0700 Subject: [PATCH] Set ReadHeaderTimeout in http server --- router/router.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/router/router.go b/router/router.go index bd0cab659..c9962d8c9 100644 --- a/router/router.go +++ b/router/router.go @@ -3,6 +3,7 @@ package router import ( "fmt" "net/http" + "time" "github.com/prometheus/client_golang/prometheus/promhttp" log "github.com/sirupsen/logrus" @@ -386,8 +387,9 @@ func Start() error { h2s := &http2.Server{} server := &http.Server{ - Addr: fmt.Sprintf("%s:%d", ip, port), - Handler: h2c.NewHandler(http.DefaultServeMux, h2s), + Addr: fmt.Sprintf("%s:%d", ip, port), + ReadHeaderTimeout: 4 * time.Second, + Handler: h2c.NewHandler(http.DefaultServeMux, h2s), } log.Infof("Web server is listening on IP %s port %d.", ip, port)