diff --git a/pkg/api/controller.go b/pkg/api/controller.go index 40f9422b..c06c1fcb 100644 --- a/pkg/api/controller.go +++ b/pkg/api/controller.go @@ -8,6 +8,7 @@ import ( "net" "net/http" "os" + "time" "github.com/anuvu/zot/errors" ext "github.com/anuvu/zot/pkg/extensions" @@ -17,6 +18,10 @@ import ( "github.com/gorilla/mux" ) +const ( + idleTimeout = 120 * time.Second +) + type Controller struct { Config *Config Router *mux.Router @@ -60,7 +65,11 @@ func (c *Controller) Run() error { _ = NewRouteHandler(c) addr := fmt.Sprintf("%s:%s", c.Config.HTTP.Address, c.Config.HTTP.Port) - server := &http.Server{Addr: addr, Handler: c.Router} + server := &http.Server{ + Addr: addr, + Handler: c.Router, + IdleTimeout: idleTimeout, + } c.Server = server // Create the listener