From 233d8067f18020662b65ad599f218e2f4e4e9a65 Mon Sep 17 00:00:00 2001 From: Z User Date: Wed, 30 Sep 2026 12:37:34 +0000 Subject: [PATCH] fix(ci): VMess URI host field only set when explicitly configured MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The CDN access fix (b317042) added a fallback that set the VMess 'host' field from the server address when no ws Host header or SNI was configured. This broke TestVMessURIOmitsWebSocketHostWhenUnset which correctly asserts that v2rayN's VmessQRCode schema has no 'host' field — the server address goes in 'add', not 'host'. Fix: only set obj["host"] from: 1. Explicit ws-headers Host (user configured) 2. SNI/servername (TLS config) Never from the server address (that's what 'add' is for). Tests: 24/24 packages PASS (including all 4 VMess URI tests). --- backend/internal/node/uri_builders.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/backend/internal/node/uri_builders.go b/backend/internal/node/uri_builders.go index 4c5fe0d..cfe4aad 100644 --- a/backend/internal/node/uri_builders.go +++ b/backend/internal/node/uri_builders.go @@ -198,11 +198,12 @@ func vmessURIs(name, host, port string, cfg map[string]interface{}) ([]string, e obj["host"] = h } } + // v2rayN's VmessQRCode schema has no "host" field. Only set it when + // the listener explicitly configured a ws Host header or SNI — + // never infer from the server address (that's what "add" is for). if obj["host"] == "" { if h := tlsOpts["sni"]; h != "" { obj["host"] = h - } else if host != "" && !looksLikeIP(host) { - obj["host"] = host } } }