From 01a7dc807beaa8007ed83010b2c99424b5fb18f7 Mon Sep 17 00:00:00 2001 From: Abdalrahman Date: Thu, 14 May 2026 11:02:45 +0300 Subject: [PATCH] fix(sub): include xhttp mode in extra JSON for karing compatibility (#4365) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add mode to buildXhttpExtra() so clients reading xtra param (karing, etc.) receive the xhttp mode alongside other bidirectional SplitHTTP fields. Previously mode was only a flat URL param and was silently dropped when xtra was present. - Add xhttp case to streamData() to strip acceptProxyProtocol and server-only fields (noSSEHeader, scMaxBufferedPosts, scStreamUpServerSecs, serverMaxHeaderBytes) from JSON sub configs. - Sync frontend buildXhttpExtra() with the same mode addition. Closes #4364 --- frontend/src/models/inbound.js | 4 ++++ sub/subJsonService.go | 8 ++++++++ sub/subService.go | 4 ++++ 3 files changed, 16 insertions(+) diff --git a/frontend/src/models/inbound.js b/frontend/src/models/inbound.js index b2201d6f..29b0057a 100644 --- a/frontend/src/models/inbound.js +++ b/frontend/src/models/inbound.js @@ -1595,6 +1595,10 @@ export class Inbound extends XrayCommonClass { }); } + if (typeof xhttp.mode === 'string' && xhttp.mode.length > 0) { + extra.mode = xhttp.mode; + } + const stringFields = [ "sessionPlacement", "sessionKey", "seqPlacement", "seqKey", diff --git a/sub/subJsonService.go b/sub/subJsonService.go index 4fe77b88..3b34ed68 100644 --- a/sub/subJsonService.go +++ b/sub/subJsonService.go @@ -265,6 +265,14 @@ func (s *SubJsonService) streamData(stream string) map[string]any { streamSettings["wsSettings"] = s.removeAcceptProxy(streamSettings["wsSettings"]) case "httpupgrade": streamSettings["httpupgradeSettings"] = s.removeAcceptProxy(streamSettings["httpupgradeSettings"]) + case "xhttp": + streamSettings["xhttpSettings"] = s.removeAcceptProxy(streamSettings["xhttpSettings"]) + if xhttp, ok := streamSettings["xhttpSettings"].(map[string]any); ok { + delete(xhttp, "noSSEHeader") + delete(xhttp, "scMaxBufferedPosts") + delete(xhttp, "scStreamUpServerSecs") + delete(xhttp, "serverMaxHeaderBytes") + } } return streamSettings } diff --git a/sub/subService.go b/sub/subService.go index 4679165c..d769bf5a 100644 --- a/sub/subService.go +++ b/sub/subService.go @@ -1025,6 +1025,10 @@ func buildXhttpExtra(xhttp map[string]any) map[string]any { } } + if mode, ok := xhttp["mode"].(string); ok && len(mode) > 0 { + extra["mode"] = mode + } + stringFields := []string{ "sessionPlacement", "sessionKey", "seqPlacement", "seqKey",