diff --git a/cmd/dendrite-monolith-server/main.go b/cmd/dendrite-monolith-server/main.go index d4aa28c75..6b0d83ae1 100644 --- a/cmd/dendrite-monolith-server/main.go +++ b/cmd/dendrite-monolith-server/main.go @@ -102,11 +102,11 @@ func main() { if *certFile != "" && *keyFile != "" { go func() { serv := http.Server{ - Addr: *httpBindAddr, + Addr: *httpsBindAddr, WriteTimeout: basecomponent.HTTPServerTimeout, } - logrus.Info("Listening on ", *httpsBindAddr) + logrus.Info("Listening on ", serv.Addr) logrus.Fatal(serv.ListenAndServeTLS(*certFile, *keyFile)) }() } diff --git a/common/basecomponent/base.go b/common/basecomponent/base.go index 73e01de13..78894289e 100644 --- a/common/basecomponent/base.go +++ b/common/basecomponent/base.go @@ -210,20 +210,20 @@ func (b *BaseDendrite) SetupAndServeHTTP(bindaddr string, listenaddr string) { addr = listenaddr } - common.SetupHTTPAPI(http.DefaultServeMux, common.WrapHandlerInCORS(b.APIMux), b.Cfg) - logrus.Infof("Starting %s server on %s", b.componentName, addr) - serv := http.Server{ Addr: addr, WriteTimeout: HTTPServerTimeout, } + common.SetupHTTPAPI(http.DefaultServeMux, common.WrapHandlerInCORS(b.APIMux), b.Cfg) + logrus.Infof("Starting %s server on %s", b.componentName, serv.Addr) + err := serv.ListenAndServe() if err != nil { logrus.WithError(err).Fatal("failed to serve http") } - logrus.Infof("Stopped %s server on %s", b.componentName, addr) + logrus.Infof("Stopped %s server on %s", b.componentName, serv.Addr) } // setupKafka creates kafka consumer/producer pair from the config.