all repos — website @ d07ec650aafcfe4692bba8f481bc3cb8204cd4b0

My website

fix redirect loops on non-standard ports
Alan Pearce alan@alanpearce.eu
Thu, 27 Jun 2024 13:25:26 +0200
commit

d07ec650aafcfe4692bba8f481bc3cb8204cd4b0

parent

443e0053bcc71fdf33a54540ec2ac4495133da87

1 files changed, 3 insertions(+), 1 deletions(-)

jump to
M internal/server/server.gointernal/server/server.go
@@ -61,13 +61,15 @@ } else { 		config.Domains = []string{runtimeConfig.ListenAddress}
 	}
 	scheme := "http"
+	port := runtimeConfig.Port
 	if runtimeConfig.TLS {
 		scheme = "https"
+		port = runtimeConfig.TLSPort
 	}
 	config.BaseURL = cfg.URL{
 		URL: &url.URL{
 			Scheme: scheme,
-			Host:   runtimeConfig.ListenAddress,
+			Host:   net.JoinHostPort(config.Domains[0], strconv.Itoa(port)),
 		},
 	}
 }