Set ReadHeaderTimeout in http server

This commit is contained in:
Gabe Kangas 2022-07-18 11:08:49 -07:00
parent 3d9703f32a
commit b75cb1784b
No known key found for this signature in database
GPG key ID: 9A56337728BC81EA

View file

@ -3,6 +3,7 @@ package router
import (
"fmt"
"net/http"
"time"
"github.com/prometheus/client_golang/prometheus/promhttp"
log "github.com/sirupsen/logrus"
@ -374,8 +375,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)