Merge pull request #5741 from addielaruee/fix/stream-ipv6-forward-host-brackets

fix(stream): bracket IPv6 forward host for valid nginx upstream
This commit is contained in:
jc21
2026-09-23 14:29:27 +10:00
committed by GitHub
+9
View File
@@ -1,4 +1,5 @@
import fs from "node:fs";
import net from "node:net";
import { dirname } from "node:path";
import { fileURLToPath } from "node:url";
import _ from "lodash";
@@ -226,6 +227,14 @@ const internalNginx = {
host.forward_scheme = "$scheme";
}
// A stream forwarding to an IPv6 literal must have the address wrapped in
// square brackets before nginx appends ":<port>". Without the brackets nginx
// reads the trailing ":<port>" as part of the address and rejects the upstream
// ("invalid port in upstream"), so the stream saves but never activates (#5740).
if (nice_host_type === "stream" && net.isIPv6(host.forwarding_host)) {
host.forwarding_host = `[${host.forwarding_host}]`;
}
if (host.locations) {
//logger.info ('host.locations = ' + JSON.stringify(host.locations, null, 2));
origLocations = [].concat(host.locations);