From 37c85361ba842ad0860b6578b9cee13e1fe67951 Mon Sep 17 00:00:00 2001 From: Hein Date: Wed, 7 Jan 2026 12:06:08 +0200 Subject: [PATCH] =?UTF-8?q?feat(cors):=20=E2=9C=A8=20add=20check=20for=20s?= =?UTF-8?q?erver=20port=20in=20CORS=20config?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pkg/common/cors.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pkg/common/cors.go b/pkg/common/cors.go index 0325af6..45a4078 100644 --- a/pkg/common/cors.go +++ b/pkg/common/cors.go @@ -26,10 +26,13 @@ func DefaultCORSConfig() CORSConfig { for i := range cfg.Servers.Instances { server := cfg.Servers.Instances[i] + if server.Port == 0 { + continue + } + hosts = append(hosts, server.ExternalURLs...) hosts = append(hosts, fmt.Sprintf("http://%s:%d", server.Host, server.Port)) hosts = append(hosts, fmt.Sprintf("https://%s:%d", server.Host, server.Port)) hosts = append(hosts, fmt.Sprintf("http://%s:%d", "localhost", server.Port)) - hosts = append(hosts, server.ExternalURLs...) for _, ip := range ipsList { hosts = append(hosts, fmt.Sprintf("http://%s:%d", ip.String(), server.Port)) hosts = append(hosts, fmt.Sprintf("https://%s:%d", ip.String(), server.Port))