Skip to content

Commit 6183bed

Browse files
committed
fix server not starting with http redirect enabled
1 parent 9878929 commit 6183bed

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

internal/server/server.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ func start(s *fiber.App) {
119119
go ssh.Serve()
120120
}
121121
if !config.Get().Server.TLS.Enabled {
122+
log.WithField("port", config.Get().Server.Port).Info("TLS is disabled starting http server")
122123
log.WithError(s.Listen(fmt.Sprintf(":%d", config.Get().Server.Port))).Fatal()
123124
}
124125
// TLS enabled
@@ -133,9 +134,13 @@ func start(s *fiber.App) {
133134
)
134135
},
135136
)
136-
go log.WithError(httpServer.Listen(":80")).Fatal()
137+
log.Info("TLS and http redirect enabled, starting redirect server on port 80")
138+
go func() {
139+
log.WithError(httpServer.Listen(":80")).Fatal()
140+
}()
137141
}
138142
time.Sleep(time.Millisecond) // This is just for a more pretty output with the tls header printed after the http one
143+
log.Info("TLS enabled, starting https server on port 443")
139144
log.WithError(s.ListenTLS(":443", config.Get().Server.TLS.Cert, config.Get().Server.TLS.Key)).Fatal()
140145
}
141146

0 commit comments

Comments
 (0)