From a18db163f2b90365bf09c748e704a340dd97aaa3 Mon Sep 17 00:00:00 2001 From: Denis Kirillov Date: Fri, 30 Sep 2022 16:26:07 +0300 Subject: [PATCH] [#716] Fix start TLS server Signed-off-by: Denis Kirillov --- cmd/s3-gw/app.go | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/cmd/s3-gw/app.go b/cmd/s3-gw/app.go index f65f49c..b20387e 100644 --- a/cmd/s3-gw/app.go +++ b/cmd/s3-gw/app.go @@ -418,17 +418,13 @@ func (a *App) Serve(ctx context.Context) { a.log.Fatal("failed to update cert", zap.Error(err)) } - lnTLS := tls.NewListener(ln, &tls.Config{ + ln = tls.NewListener(ln, &tls.Config{ GetCertificate: a.tlsProvider.GetCertificate, }) + } - if err = srv.ServeTLS(lnTLS, certFile, keyFile); err != nil && err != http.ErrServerClosed { - a.log.Fatal("listen and serve", zap.Error(err)) - } - } else { - if err = srv.Serve(ln); err != nil && err != http.ErrServerClosed { - a.log.Fatal("listen and serve", zap.Error(err)) - } + if err = srv.Serve(ln); err != nil && err != http.ErrServerClosed { + a.log.Fatal("listen and serve", zap.Error(err)) } }()