Set ReadHeaderTimeout in http server
This commit is contained in:
parent
3d9703f32a
commit
b75cb1784b
@ -3,6 +3,7 @@ package router
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/prometheus/client_golang/prometheus/promhttp"
|
"github.com/prometheus/client_golang/prometheus/promhttp"
|
||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
@ -375,6 +376,7 @@ func Start() error {
|
|||||||
h2s := &http2.Server{}
|
h2s := &http2.Server{}
|
||||||
server := &http.Server{
|
server := &http.Server{
|
||||||
Addr: fmt.Sprintf("%s:%d", ip, port),
|
Addr: fmt.Sprintf("%s:%d", ip, port),
|
||||||
|
ReadHeaderTimeout: 4 * time.Second,
|
||||||
Handler: h2c.NewHandler(http.DefaultServeMux, h2s),
|
Handler: h2c.NewHandler(http.DefaultServeMux, h2s),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user