Browse Source

Set ReadHeaderTimeout in http server

pull/2032/head
Gabe Kangas 3 years ago
parent
commit
49f977ea45
No known key found for this signature in database
GPG Key ID: 9A56337728BC81EA
  1. 6
      router/router.go

6
router/router.go

@ -3,6 +3,7 @@ package router @@ -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 { @@ -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)

Loading…
Cancel
Save