diff options
Diffstat (limited to 'internal/server/tls.go')
-rw-r--r-- | internal/server/tls.go | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/internal/server/tls.go b/internal/server/tls.go index 71dde54..85eaac9 100644 --- a/internal/server/tls.go +++ b/internal/server/tls.go @@ -105,15 +105,15 @@ func (s *Server) serveTLS() (err error) { } url := r.URL url.Scheme = "https" - host, _, err := net.SplitHostPort(r.Host) - if err != nil { - log.Warn("error splitting host and port", "error", err) - host = s.config.BaseURL.Hostname() - } port := s.config.BaseURL.Port() if port == "" { - url.Host = host + url.Host = r.Host } else { + host, _, err := net.SplitHostPort(r.Host) + if err != nil { + log.Warn("error splitting host and port", "error", err) + host = r.Host + } url.Host = net.JoinHostPort(host, s.config.BaseURL.Port()) } http.Redirect(w, r, url.String(), http.StatusMovedPermanently) |