From 18ab16c58b63fde717aebb9e32695f59a627c6a1 Mon Sep 17 00:00:00 2001 From: dominic_dl Date: Sat, 20 Aug 2022 12:14:29 +0200 Subject: [PATCH] Minor changes - fix lint error - move the code inside the clusterUrl.hostname check - add small Comment to explane the code Signed-off-by: dominic_dl --- src/main/context-handler/context-handler.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/context-handler/context-handler.ts b/src/main/context-handler/context-handler.ts index fa01c1fcf5..e44a14702b 100644 --- a/src/main/context-handler/context-handler.ts +++ b/src/main/context-handler/context-handler.ts @@ -155,10 +155,12 @@ export class ContextHandler implements ClusterContextHandler { if (this.clusterUrl.hostname) { headers.Host = this.clusterUrl.hostname; - } - if (headers.Host.includes(":")) { - headers.Host = "[" + headers.Host + "]"; + // 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 {