about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--internal/server/tls.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/internal/server/tls.go b/internal/server/tls.go
index 1a79e9c..71dde54 100644
--- a/internal/server/tls.go
+++ b/internal/server/tls.go
@@ -110,7 +110,12 @@ func (s *Server) serveTLS() (err error) {
 				log.Warn("error splitting host and port", "error", err)
 				host = s.config.BaseURL.Hostname()
 			}
-			url.Host = net.JoinHostPort(host, s.config.BaseURL.Port())
+			port := s.config.BaseURL.Port()
+			if port == "" {
+				url.Host = host
+			} else {
+				url.Host = net.JoinHostPort(host, s.config.BaseURL.Port())
+			}
 			http.Redirect(w, r, url.String(), http.StatusMovedPermanently)
 		})
 		srv.Handler = httpMux