mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #5577] [Bug]: Change in XHTTP session fields breaks backward compatibility with older Xray-core versions #3896
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#3896
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 @PA4EJIJIA on GitHub (Jun 26, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5577
Describe the bug
After the recent panel update, XHTTP inbound parameters and subscription generation logic were changed to support the new Xray-core syntax (specifically, renaming sessionPlacement to sessionIDPlacement and sessionKey to sessionIDKey).
While this aligns with the Xray-core pre-release branch, it breaks setups using customized XHTTP sessions settings on older Xray-core versions, as the older core ignores these new JSON keys and falls back to hardcoded defaults, causing a desynchronization between the panel, the server core, and the clients.
Forcing users to upgrade to the latest pre-release core is currently not a viable option due to critical regressions in that specific branch. In Xray-core v26.6.22, there is a bug in the built-in DNS module, leading to resolution failures, connection failures, or DNS leaks.
How to reproduce the problem
When a user selects older Xray-core version in the panel settings but runs customized XHTTP inbound configurations:
The panel writes sessionIDPlacement / sessionIDKey into config.json.
The older server-side core does not recognize these keys and discards them, using the defaults.
The panel generates client subscription links using the new sessionID* syntax.
Client apps running older core does not recognize these keys and discards them, using the defaults, which allows it to connect but makes the customized settings pointless. If they run core 26.6.22 (which they won't because of it's DNS bugged), then they will parse new keys correctly but fail to connect to the server.
Expected behavior
Please add a backward compatibility fallback mechanism. The panel should either:
Check the currently selected/running Xray-core version in the settings and adapt the config/subscription output accordingly.
Or dynamically output both sets of keys (sessionPlacement / sessionKey AND sessionIDPlacement / sessionIDKey) in the generated server config and subscription data, so that older stable cores and clients can still read their respective parameters without breaking.
Actual behavior
No response
Relevant logs
Screenshots
No response
3x-ui version
3.4.1
Xray-core version
26.6.1
How did you install 3x-ui?
install.sh script
Operating system
Ubuntu 24.04
Which parts of the panel are affected?
Xray config generation, 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 (Jun 26, 2026):
The behavior is confirmed against the v3.4.1 source. Here is what the code does and where the incompatibility arises.
What changed and why
xray-core PR #6258 (incorporated into approximately v26.6.22) renamed
sessionPlacement/sessionKeytosessionIDPlacement/sessionIDKeyin the XHTTP stream settings, and the new core dropped all backward-compat fallback for the old names. Panel v3.4.1 was updated to match that rename.Where the one-way migration happens
internal/web/service/xray.go:1097–1118):liftXhttpSessionIDKeys()is called unconditionally during every config build. It reads whatever is stored in the database (old or new names) and always writessessionIDPlacement/sessionIDKeyinto the generatedconfig.json. There is no version-conditional branch.internal/sub/service.go:1754): the subscription link builder enumerates only the new field names. The legacy-key fallback at lines 1773–1784 exists only to handle DB records that still carry the old names — it maps them onto the new names in the share link, not back to the old ones.internal/sub/clash_service.go:407–438): same pattern.Why v26.6.1 is affected
The stable Xray-core v26.6.1 binary predates PR #6258. It recognises
sessionPlacementandsessionKeyand has no knowledge ofsessionIDPlacement/sessionIDKey. When the panel writes the new names toconfig.json, the running core silently ignores them and applies its compiled-in defaults, discarding whatever custom values were set. The panel'sGetXrayVersion()(internal/web/service/xray.go:95–99) does expose the running binary's version string, but nothing in the config-generation pipeline currently uses it to conditionally choose field names.Current state
There is no per-version adaptation in the config or subscription code paths. The panel's own Go module dependency (
go.modline 24) pins a June 22 2026 pre-release of xray-core that includes PR #6258, so the panel itself is designed around the new names exclusively.Potential mitigations while a code fix is discussed
Regarding the feature request
Version-adaptive output (detect the running binary version and emit the matching field name set) or dual-key output (emit both old and new names simultaneously) are both conceivable approaches. Dual-key output is the simpler one to implement and does not require parsing a version string, but it would need to be verified against the new xray-core's parsing behavior (whether it tolerates both keys being present or treats a conflict as an error). A maintainer should evaluate which approach fits the project's compatibility policy.
For tracking purposes:
internal/web/service/xray.go(config generation) andinternal/sub/service.go+internal/sub/clash_service.go(subscription generation) are the three files that would need changes for any backward-compat mechanism.This reply was generated automatically by an issue-triage assistant; a maintainer may follow up.