diff --git a/modules/http_proxy.go b/modules/http_proxy.go index 3e38811b..e8e16dfd 100644 --- a/modules/http_proxy.go +++ b/modules/http_proxy.go @@ -1,9 +1,11 @@ package modules import ( + "context" "fmt" "net/http" "strings" + "time" "github.com/elazarl/goproxy" @@ -191,7 +193,9 @@ func (p *HttpProxy) Start() error { func (p *HttpProxy) Stop() error { if p.Running() == true { p.SetRunning(false) - p.server.Shutdown(nil) + ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second) + defer cancel() + p.server.Shutdown(ctx) if p.redirection != nil { log.Debug("Disabling redirection %s", p.redirection.String()) if err := p.Session.Firewall.EnableRedirection(p.redirection, false); err != nil {