[PR #4365] [MERGED] fix(sub): include xhttp mode in extra JSON for karing compatibility #5675

Closed
opened 2026-11-02 04:03:14 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/4365
Author: @abdalrahmanx9
Created: 5/14/2026
Status: ✅ Merged
Merged: 5/14/2026
Merged by: @MHSanaei

Base: main ← Head: fix/xhttp-mode-in-extra


📝 Commits (1)

  • b47daa0 fix(sub): include xhttp mode in extra JSON for karing compatibility

📊 Changes

3 files changed (+16 additions, -0 deletions)

View changed files

📝 frontend/src/models/inbound.js (+4 -0)
📝 sub/subJsonService.go (+8 -0)
📝 sub/subService.go (+4 -0)

📄 Description

Summary

  • Fix karing (and other clients) losing xhttp mode when xPaddingBytes or scMaxEachPostBytes is configured
  • Fix JSON subscription leaking server-only xhttp fields to clients

Closes #4364

Problem

When an xhttp inbound has xPaddingBytes or scMaxEachPostBytes set, the share URL
includes an + "extra=" + @ query param containing bidirectional SplitHTTP fields.
karing reads exclusively from + "extra" + @ for transport settings, but + "mode" + @ was only
emitted as a flat URL param ( + "mode=packet-up" + @), never inside + "extra" + @. This silently
dropped the mode, breaking the connection entirely.

// Before (broken karing import):
"transport": {
    "type": "xhttp",
    "host": "...",
    "path": "...",
    "x_padding_bytes": "100-1000",    // flat param ✓
    "sc_max_each_post_bytes": "1000000" // from extra ✓
    // mode MISSING — defaults to wrong behavior
}

// After (fixed):
"transport": {
    "type": "xhttp",
    "host": "...",
    "path": "...",
    "mode": "packet-up",               // now in extra ✓
    "x_padding_bytes": "100-1000",     // flat param ✓
    "sc_max_each_post_bytes": "1000000" // from extra ✓
}

Changes

  • sub/subService.go: Include mode in buildXhttpExtra() so it is available in the + "extra" + @ JSON blob alongside other bidirectional SplitHTTP fields
  • frontend/src/models/inbound.js: Same fix in the panel share-link generator for parity
  • sub/subJsonService.go: Add xhttp case to streamData() to strip acceptProxyProtocol and server-only fields (noSSEHeader, scMaxBufferedPosts, scStreamUpServerSecs, serverMaxHeaderBytes) from JSON subscription configs, matching how tcp/ws/httpupgrade are already sanitized

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/MHSanaei/3x-ui/pull/4365 **Author:** [@abdalrahmanx9](https://github.com/abdalrahmanx9) **Created:** 5/14/2026 **Status:** ✅ Merged **Merged:** 5/14/2026 **Merged by:** [@MHSanaei](https://github.com/MHSanaei) **Base:** `main` ← **Head:** `fix/xhttp-mode-in-extra` --- ### 📝 Commits (1) - [`b47daa0`](https://github.com/MHSanaei/3x-ui/commit/b47daa090000af499af86b272eb091aa05439e3e) fix(sub): include xhttp mode in extra JSON for karing compatibility ### 📊 Changes **3 files changed** (+16 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `frontend/src/models/inbound.js` (+4 -0) 📝 `sub/subJsonService.go` (+8 -0) 📝 `sub/subService.go` (+4 -0) </details> ### 📄 Description ## Summary - Fix karing (and other clients) losing xhttp `mode` when `xPaddingBytes` or `scMaxEachPostBytes` is configured - Fix JSON subscription leaking server-only xhttp fields to clients Closes #4364 ## Problem When an xhttp inbound has `xPaddingBytes` or `scMaxEachPostBytes` set, the share URL includes an ` + "`extra=<json>`" + @` query param containing bidirectional SplitHTTP fields. karing reads exclusively from ` + "`extra`" + @` for transport settings, but ` + "`mode`" + @` was only emitted as a flat URL param (` + "`mode=packet-up`" + @`), never inside ` + "`extra`" + @`. This silently dropped the mode, breaking the connection entirely. ```json // Before (broken karing import): "transport": { "type": "xhttp", "host": "...", "path": "...", "x_padding_bytes": "100-1000", // flat param ✓ "sc_max_each_post_bytes": "1000000" // from extra ✓ // mode MISSING — defaults to wrong behavior } // After (fixed): "transport": { "type": "xhttp", "host": "...", "path": "...", "mode": "packet-up", // now in extra ✓ "x_padding_bytes": "100-1000", // flat param ✓ "sc_max_each_post_bytes": "1000000" // from extra ✓ } ``` ## Changes - **`sub/subService.go`**: Include `mode` in `buildXhttpExtra()` so it is available in the ` + "`extra`" + @` JSON blob alongside other bidirectional SplitHTTP fields - **`frontend/src/models/inbound.js`**: Same fix in the panel share-link generator for parity - **`sub/subJsonService.go`**: Add `xhttp` case to `streamData()` to strip `acceptProxyProtocol` and server-only fields (`noSSEHeader`, `scMaxBufferedPosts`, `scStreamUpServerSecs`, `serverMaxHeaderBytes`) from JSON subscription configs, matching how tcp/ws/httpupgrade are already sanitized --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 04:03:14 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#5675
No description provided.