From ac6a5f9b835a7939d52a7a0ce672e41aec3754f9 Mon Sep 17 00:00:00 2001 From: Dominic1DL <57274408+Dominic1DL@users.noreply.github.com> Date: Tue, 30 Aug 2022 14:17:51 +0200 Subject: [PATCH] Fix IPv6 missing brackets in httpProxy.ServerOptions (#5914) --- src/main/context-handler/context-handler.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/context-handler/context-handler.ts b/src/main/context-handler/context-handler.ts index 1917461c34..e44a14702b 100644 --- a/src/main/context-handler/context-handler.ts +++ b/src/main/context-handler/context-handler.ts @@ -155,6 +155,12 @@ export class ContextHandler implements ClusterContextHandler { if (this.clusterUrl.hostname) { headers.Host = this.clusterUrl.hostname; + + // fix current IPv6 inconsistency in url.Parse() and httpProxy. + // with url.Parse the IPv6 Hostname has no Square brackets but httpProxy needs the Square brackets to work. + if (headers.Host.includes(":")) { + headers.Host = `[${headers.Host}]`; + } } return {