about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAlan Pearce2024-06-27 13:25:26 +0200
committerAlan Pearce2024-06-27 13:25:26 +0200
commitd07ec650aafcfe4692bba8f481bc3cb8204cd4b0 (patch)
tree5fe0a3b903596faff8015f5c27884ef92652a529
parent443e0053bcc71fdf33a54540ec2ac4495133da87 (diff)
downloadwebsite-d07ec650aafcfe4692bba8f481bc3cb8204cd4b0.tar.lz
website-d07ec650aafcfe4692bba8f481bc3cb8204cd4b0.tar.zst
website-d07ec650aafcfe4692bba8f481bc3cb8204cd4b0.zip
fix redirect loops on non-standard ports
-rw-r--r--internal/server/server.go4
1 files changed, 3 insertions, 1 deletions
diff --git a/internal/server/server.go b/internal/server/server.go
index 1512632..00cc022 100644
--- a/internal/server/server.go
+++ b/internal/server/server.go
@@ -61,13 +61,15 @@ func applyDevModeOverrides(config *cfg.Config, runtimeConfig *Config) {
 		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)),
 		},
 	}
 }