Fix IPv6 missing brackets in httpProxy.ServerOptions (#5914)

This commit is contained in:
Dominic1DL authored and Sebastian Malton committed 2022-08-30 11:13:55 -04:00
1 parent 2c0702fb43
commit 4d5fe399fc
1 file changed
+6
@@ -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 {