diff --git a/internal/api/api.go b/internal/api/api.go index 4eac03b..d78b4e8 100644 --- a/internal/api/api.go +++ b/internal/api/api.go @@ -53,8 +53,9 @@ func (as *ApiServer) Start(config config.ApiConfig) { as.serverMu.Lock() defer as.serverMu.Unlock() as.server = &http.Server{ - Addr: fmt.Sprintf(":%d", as.config.Port), - Handler: mux, + Addr: fmt.Sprintf(":%d", as.config.Port), + ReadHeaderTimeout: 5 * time.Second, + Handler: mux, } go func() { diff --git a/internal/module/http-server.go b/internal/module/http-server.go index ae8d95f..942930e 100644 --- a/internal/module/http-server.go +++ b/internal/module/http-server.go @@ -7,6 +7,7 @@ import ( "fmt" "log/slog" "net/http" + "time" "github.com/google/jsonschema-go/jsonschema" "github.com/jwetzell/showbridge-go/internal/common" @@ -163,8 +164,9 @@ func (hs *HTTPServer) Start(ctx context.Context, router common.RouteIO) error { hs.cancel = cancel httpServer := &http.Server{ - Addr: fmt.Sprintf(":%d", hs.Port), - Handler: hs, + Addr: fmt.Sprintf(":%d", hs.Port), + ReadHeaderTimeout: 5 * time.Second, + Handler: hs, } go func() {