[GH-ISSUE #5577] [Bug]: Change in XHTTP session fields breaks backward compatibility with older Xray-core versions #3896

Closed
opened 2026-10-31 20:35:43 +07:00 by bsakaguchi · 1 comment
Owner

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:

  1. The panel writes sessionIDPlacement / sessionIDKey into config.json.

  2. The older server-side core does not recognize these keys and discards them, using the defaults.

  3. The panel generates client subscription links using the new sessionID* syntax.

  4. 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

  • I searched existing issues and this bug has not been reported.
  • I am running the latest released version of 3x-ui (or have verified the bug still exists on it).
  • This bug report is written in English.
  • I have redacted any sensitive data (tokens, real domains, client UUIDs).
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: 1. The panel writes sessionIDPlacement / sessionIDKey into config.json. 2. The older server-side core does not recognize these keys and discards them, using the defaults. 3. The panel generates client subscription links using the new sessionID* syntax. 4. 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 ```shell ``` ### 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 - [x] I searched [existing issues](../issues?q=is%3Aissue) and this bug has not been reported. - [x] I am running the latest released version of 3x-ui (or have verified the bug still exists on it). - [x] This bug report is written in English. - [x] I have redacted any sensitive data (tokens, real domains, client UUIDs).
bsakaguchi 2026-10-31 20:35:43 +07:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@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/sessionKey to sessionIDPlacement/sessionIDKey in 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

  • Config generation (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 writes sessionIDPlacement/sessionIDKey into the generated config.json. There is no version-conditional branch.
  • Subscription output (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.
  • Clash subscription (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 sessionPlacement and sessionKey and has no knowledge of sessionIDPlacement/sessionIDKey. When the panel writes the new names to config.json, the running core silently ignores them and applies its compiled-in defaults, discarding whatever custom values were set. The panel's GetXrayVersion() (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.mod line 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

  1. Pin a known-stable xray-core binary that already includes PR #6258 but precedes the DNS regression you described. You can install a specific version through the panel's UI (Settings → Xray core → install a specific release). Whether such a release exists and is usable is outside this panel's scope.
  2. If you need to stay on v26.6.1 and custom session settings matter, there is currently no supported workaround at the panel level; the rename is unconditional.

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) and internal/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.

<!-- gh-comment-id:4805444889 --> @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`/`sessionKey` to `sessionIDPlacement`/`sessionIDKey` in 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** - **Config generation** (`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 writes `sessionIDPlacement`/`sessionIDKey` into the generated `config.json`. There is no version-conditional branch. - **Subscription output** (`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. - **Clash subscription** (`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 `sessionPlacement` and `sessionKey` and has no knowledge of `sessionIDPlacement`/`sessionIDKey`. When the panel writes the new names to `config.json`, the running core silently ignores them and applies its compiled-in defaults, discarding whatever custom values were set. The panel's `GetXrayVersion()` (`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.mod` line 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** 1. Pin a known-stable xray-core binary that already includes PR #6258 but precedes the DNS regression you described. You can install a specific version through the panel's UI (Settings → Xray core → install a specific release). Whether such a release exists and is usable is outside this panel's scope. 2. If you need to stay on v26.6.1 and custom session settings matter, there is currently no supported workaround at the panel level; the rename is unconditional. **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) and `internal/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._
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#3896
No description provided.