mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 19:11:53 +07:00
[GH-ISSUE #5983] [Bug]: Universal subscription link for VLESS+XHTTP is not parseable by third-party clients (duplicate mode/x_padding_bytes inside "extra" JSON) #4147
Labels
No labels
backlog
bug
clarification needed
documentation
duplicate
enhancement
github_actions
good first issue
invalid
javascript
New Feature
PR welcomed
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MHSanaei/3x-ui#4147
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @KillReal1234 on GitHub (Jul 15, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5983
Describe the bug
The VLESS+XHTTP line in the plain/universal subscription (base64 list of URIs) duplicates fields both as flat query params and inside a raw JSON blob in
extra:vless://@host:443?alpn=h2%2Chttp%2F1.1&extra=%7B%22mode%22%3A%22packet-up%22%2C%22xPaddingBytes%22%3A%22100-1000%22%7D&fp=firefox&host=host&mode=packet-up&path=%2F...&security=tls&type=xhttp&x_padding_bytes=100-1000
extra(and the duplicatedmode/x_padding_bytes) are not part of any documented VLESS/XHTTP URI convention. Third-party parsers (mihomo, subconverter) either drop this node or fail entirely on it. This appears related to #4347 (Clash/Mihomo subscription returns Error! for XHTTP), but affects the raw/universal subscription output as well, not only the dedicated /clash/ endpoint.How to reproduce the problem
Expected behavior
Only emit the standard, documented XHTTP query params (mode, path, host, extra padding settings as flat params if needed) without the redundant raw
extraJSON blob, so third-party clients can parse the link.Related issue = 4347
Actual behavior
No response
Relevant logs
Screenshots
No response
3x-ui version
3.5.0
Xray-core version
26.7.11
How did you install 3x-ui?
install.sh script
Operating system
Ubuntu 24.04
Which parts of the panel are affected?
Subscription (share links / Clash / JSON)
Browser (only if it is a UI bug)
No response
Is the panel behind a reverse proxy or CDN?
Yes — Nginx
Before submitting
@github-actions[bot] commented on GitHub (Jul 15, 2026):
Confirmed against current source. This is real and reproducible, but it's the direct consequence of a deliberate trade-off made across two earlier issues, not an isolated oversight — so the "expected behavior" in the report (just drop
extra) would silently reopen a previously-fixed regression for a different client family.Title: Plain/universal subscription and share links intentionally double-encode XHTTP
mode/padding as both flat params and a JSONextrablob; generic URI parsers (subconverter, mihomo used as a raw proxy-provider) don't understandextraSeverity: Medium
Category: API / Correctness (share-link interop)
Why this matters
internal/sub/service.go:genVlessLink(line 772) →applyShareNetworkParams, whose"xhttp"case (lines 1240-1242) callsapplyXhttpExtraParams(xhttp, params). That function (line 2102) sets flatmodeandx_padding_bytes, and packs the same fields into a JSON blob written toextra(lines 2115-2120) viabuildXhttpExtra(line 1954). That reproduces your link exactly: flatmode=packet-up+ flatx_padding_bytes=100-1000+extra={"mode":"packet-up","xPaddingBytes":"100-1000"}.applyXhttpExtraParams(lines 2084-2101) states the dual encoding exists so "every popular client can read at least one": flat params for sing-box-family clients (Karing, NekoBox, OpenWRT sing-box, Podkop),extraJSON for xray-core-family clients (v2rayNG, Happ, Furious, Exclave).internal/sub/service_test.go(lines 373-376) pins this with an explicit comment:moderides insideextra"so clients that only read the extra JSON keep the xhttp mode (#5446)".extracarriesmodespecifically because of #4364 and its regression #5446 — both about Karing silently droppingtransport.modewhenextrawas present but incomplete. Removingextra(this report's requested fix) would reopen that exact regression for Karing. This is a genuine three-way conflict between client families over a single URI shape, not a bug with one obviously-correct output.internal/sub/clash_service.go,buildXhttpClashOpts(line 438) emits a nativexhttp-optsmap, noextra. This is what fixed #4347.internal/sub/json_service.goemitsxhttpSettingsas a nested object, also noextra.subClashAutoDetect, off by default, merged yesterday in commit129f50d/ #5826) already closes the mihomo half of this gap when enabled together with Clash/Mihomo subscription (subClashEnable, also off by default): a request to the standard subscription URL whoseUser-Agentmatches the configured regex (default(?i)(clash|mihomo)) is transparently served the native Clash YAML instead of the raw list (internal/sub/controller.golines 343-346). That only helps if mihomo subscribes to the panel URL directly as a remote proxy-provider — it sends its ownUser-Agentin that case. It does not help the workflow in this report (decode the base64 payload by hand, paste the raw line into a local proxy-provider), because no HTTP request reaches the panel there, so nothing to detect.User-Agentwould matchsubClashUserAgentRegexif pointed at the panel's subscription URL isn't something this repository's source can confirm.Recommendation
This needs a maintainer decision, since the client families disagree on what a VLESS+XHTTP URI should contain:
/clash/endpoint (or the new auto-detect) instead of the raw/universal one.extrafrom plain/share-link output, accepting that opting in regresses Karing-style clients back to the #4364/#5446 symptom.buildXhttpExtrasoextrais only emitted when fields with no flat-param equivalent are actually set (i.e., a plainmode+xPaddingBytesconfig like this report's would stay on flat params only), reservingextrafor the rarer multiplexing/session fields. This would need re-verifying against Karing's actual parsing behavior first, since that's unconfirmed here and is exactly what #4364/#5446 turned on.Tagging @MHSanaei since this trades off two already-supported client families against each other and needs a decision on priority (or on branching by detected client).
This reply was generated automatically; a maintainer may follow up.
@MHSanaei commented on GitHub (Jul 23, 2026):
The extra JSON param is intentional for xray-core clients (added in #4065); dropping it regresses v2rayNG/Happ and friends. Closing — happy to reconsider with a concrete standard-only encoding that keeps the bidirectional fields.