From 3f30bf1e33e136fe318c7358ea0836102661ab1b Mon Sep 17 00:00:00 2001 From: Kristoffer Dalby Date: Sun, 31 Oct 2021 16:19:38 +0000 Subject: [PATCH] Ensure we set up TLS for http --- app.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app.go b/app.go index 683d3a7..d82eae5 100644 --- a/app.go +++ b/app.go @@ -474,7 +474,16 @@ func (h *Headscale) Serve() error { g.Go(func() error { return grpcServer.Serve(socketListener) }) g.Go(func() error { return grpcServer.Serve(grpcListener) }) - g.Go(func() error { return httpServer.Serve(httpListener) }) + + if tlsConfig != nil { + g.Go(func() error { + tlsl := tls.NewListener(httpListener, tlsConfig) + return httpServer.Serve(tlsl) + }) + } else { + g.Go(func() error { return httpServer.Serve(httpListener) }) + } + g.Go(func() error { return m.Serve() }) log.Info().Msgf("listening and serving (multiplexed HTTP and gRPC) on: %s", h.cfg.Addr)