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

This commit is contained in:
Dominic1DL authored and GitHub committed 2022-08-30 08:17:51 -04:00
1 parent 4b1c9fb5fd
commit ac6a5f9b83
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 {