all repos — website @ 80c9717db80d9ead7c0c8a8693475ed0c2150470

My website

fix HTTP->S redirects on standard port

Alan Pearce
commit

80c9717db80d9ead7c0c8a8693475ed0c2150470

parent

5edc2c104cb94bc9ed8cf05f668822a651875add

1 file changed, 6 insertions(+), 1 deletion(-)

changed files
M internal/server/tls.gointernal/server/tls.go
@@ -110,7 +110,12 @@ if err != nil {
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