[PR #5349] [MERGED] fix(inbound): strip XHTTP XMUX from xray config, keep for subscriptions #5853

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

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/5349
Author: @nima1024m
Created: 6/15/2026
Status: ✅ Merged
Merged: 6/15/2026
Merged by: @MHSanaei

Base: main ← Head: fix/inbound-xhttp-xmux-strip-from-xray-config


📝 Commits (1)

  • c30d4a6 fix(inbound): strip XHTTP client-only fields from xray config, keep for subscriptions

📊 Changes

3 files changed (+131 additions, -2 deletions)

View changed files

📝 frontend/src/test/stream-wire-normalize.test.ts (+1 -1)
📝 internal/database/model/model.go (+48 -1)
📝 internal/database/model/model_test.go (+82 -0)

📄 Description

Summary

  • Strip client-only xHTTP fields (xmux, downloadSettings, scMinPostsIntervalMs, uplinkChunkSize, noGRPCHeader) from the xray-core inbound config at GenXrayInboundConfig time
  • Leave the inbound DB streamSettings unchanged so subscription/share-link generation (buildXhttpExtra) still delivers XMUX defaults to clients
  • Fixes the mismatch where enabling inbound XMUX wrote useless knobs into bin/config.json even though xray-core's XHTTP server listener ignores them

Problem

When XMUX is enabled on an XHTTP inbound, 3x-ui correctly stores xmux in the database (for pushing client defaults via subscriptions). However, GenXrayInboundConfig passed streamSettings through verbatim, so xmux also appeared in bin/config.json and in live gRPC inbound reloads. xray-core only consumes XMUX on the client/outbound dialer — not on the server inbound.

Solution

Add StripInboundXhttpClientFields() in internal/database/model/model.go, following the existing StripVmessClientSecurity / StripVlessInboundEncryption pattern. Call it from GenXrayInboundConfig so both config.json generation (GetXrayConfig) and live inbound reload (runtime.Local.AddInbound) omit client-only fields without touching the stored inbound row.

Behaviour after this change

Layer XMUX when toggle ON
DB streamSettings Present (unchanged)
bin/config.json server inbound Absent
Subscription / share-link extra Present (unchanged)
Outbound XHTTP form Unchanged (xmux still emitted)

Test plan

  • go test ./internal/database/model/... -run "Xhttp|Xmux|StripInbound"
  • go test ./internal/sub/... -run XhttpExtra (subscription extra blob unaffected)
  • npx vitest run src/test/stream-wire-normalize.test.ts (frontend inbound save path unchanged)

Manual verification suggested:

  1. Create a VLESS + XHTTP inbound with XMUX enabled and non-default maxConcurrency
  2. Save inbound, inspect DB/API streamSettings — xmux should still be present
  3. Inspect bin/config.json (or panel → Xray → view config) — inbound xhttpSettings must not contain xmux
  4. Open a client subscription/share link — extra blob should still include xmux
  5. Edit inbound via panel (triggers gRPC reload) — confirm xray still starts cleanly

Files changed

  • internal/database/model/model.go — StripInboundXhttpClientFields, wired into GenXrayInboundConfig
  • internal/database/model/model_test.go — strip + GenXray regression tests
  • frontend/src/test/stream-wire-normalize.test.ts — clarify test description (no logic change)

🔄 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/5349 **Author:** [@nima1024m](https://github.com/nima1024m) **Created:** 6/15/2026 **Status:** ✅ Merged **Merged:** 6/15/2026 **Merged by:** [@MHSanaei](https://github.com/MHSanaei) **Base:** `main` ← **Head:** `fix/inbound-xhttp-xmux-strip-from-xray-config` --- ### 📝 Commits (1) - [`c30d4a6`](https://github.com/MHSanaei/3x-ui/commit/c30d4a6565f78456d01e84b327ff5fc7aa33c20a) fix(inbound): strip XHTTP client-only fields from xray config, keep for subscriptions ### 📊 Changes **3 files changed** (+131 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `frontend/src/test/stream-wire-normalize.test.ts` (+1 -1) 📝 `internal/database/model/model.go` (+48 -1) 📝 `internal/database/model/model_test.go` (+82 -0) </details> ### 📄 Description ## Summary - Strip client-only xHTTP fields (`xmux`, `downloadSettings`, `scMinPostsIntervalMs`, `uplinkChunkSize`, `noGRPCHeader`) from the xray-core inbound config at `GenXrayInboundConfig` time - Leave the inbound DB `streamSettings` unchanged so subscription/share-link generation (`buildXhttpExtra`) still delivers XMUX defaults to clients - Fixes the mismatch where enabling inbound XMUX wrote useless knobs into `bin/config.json` even though xray-core's XHTTP server listener ignores them ## Problem When XMUX is enabled on an XHTTP inbound, 3x-ui correctly stores `xmux` in the database (for pushing client defaults via subscriptions). However, `GenXrayInboundConfig` passed `streamSettings` through verbatim, so `xmux` also appeared in `bin/config.json` and in live gRPC inbound reloads. xray-core only consumes XMUX on the **client/outbound** dialer — not on the server inbound. ## Solution Add `StripInboundXhttpClientFields()` in `internal/database/model/model.go`, following the existing `StripVmessClientSecurity` / `StripVlessInboundEncryption` pattern. Call it from `GenXrayInboundConfig` so both config.json generation (`GetXrayConfig`) and live inbound reload (`runtime.Local.AddInbound`) omit client-only fields without touching the stored inbound row. ## Behaviour after this change | Layer | XMUX when toggle ON | |-------|---------------------| | DB `streamSettings` | Present (unchanged) | | `bin/config.json` server inbound | **Absent** | | Subscription / share-link `extra` | Present (unchanged) | | Outbound XHTTP form | Unchanged (xmux still emitted) | ## Test plan - [x] `go test ./internal/database/model/... -run "Xhttp|Xmux|StripInbound"` - [x] `go test ./internal/sub/... -run XhttpExtra` (subscription extra blob unaffected) - [x] `npx vitest run src/test/stream-wire-normalize.test.ts` (frontend inbound save path unchanged) Manual verification suggested: 1. Create a VLESS + XHTTP inbound with XMUX enabled and non-default `maxConcurrency` 2. Save inbound, inspect DB/API `streamSettings` — `xmux` should still be present 3. Inspect `bin/config.json` (or panel → Xray → view config) — inbound `xhttpSettings` must **not** contain `xmux` 4. Open a client subscription/share link — `extra` blob should still include `xmux` 5. Edit inbound via panel (triggers gRPC reload) — confirm xray still starts cleanly ## Files changed - `internal/database/model/model.go` — `StripInboundXhttpClientFields`, wired into `GenXrayInboundConfig` - `internal/database/model/model_test.go` — strip + GenXray regression tests - `frontend/src/test/stream-wire-normalize.test.ts` — clarify test description (no logic change) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 04:04:33 +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#5853
No description provided.