[GH-ISSUE #5655] [Bug]: VLESS Route field for hosts is ignored #3937

Closed
opened 2026-10-31 20:36:02 +07:00 by bsakaguchi · 2 comments
Owner

Originally created by @imtama on GitHub (Jun 29, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5655

Describe the bug

When entering a Vless Route value for a host in the panel, according to the Xray-core documentation, it should be inserted here into the user's UUID:

--------------↓↓↓↓------------------
xxxxxxxx-xxxx-0000-xxxx-xxxxxxxxxxxx

However, the panel still provides the original UUID in subscriptions.

How to reproduce the problem

  1. Create a host.
  2. Enter a value into the VLESS Route field.
  3. Check which UUID the panel provided in the subscription.

Expected behavior

No response

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

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?

No response

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 @imtama on GitHub (Jun 29, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5655 ### Describe the bug When entering a Vless Route value for a host in the panel, according to the [Xray-core documentation](https://xtls.github.io/en/config/routing.html#ruleobject), it should be inserted here into the user's UUID: ``` --------------↓↓↓↓------------------ xxxxxxxx-xxxx-0000-xxxx-xxxxxxxxxxxx ``` However, the panel still provides the original UUID in subscriptions. ### How to reproduce the problem 1. Create a host. 2. Enter a value into the VLESS Route field. 3. Check which UUID the panel provided in the subscription. ### Expected behavior _No response_ ### 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 ### 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? _No response_ ### 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:36:02 +07:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@github-actions[bot] commented on GitHub (Jun 29, 2026):

The VlessRoute field is stored in the database but never included in any subscription output — confirmed against the current source (v3.4.1 / commit 7a5d6da).

What the code shows:

  • The field is defined in the Host model (internal/database/model/model.go:777) as VlessRoute string, described as a "free-form port/range routing spec (e.g. '53,443,1000-2000')". The UI hint in internal/web/translation/en-US.json reads: "Ports/ranges routed via VLESS, e.g. 53,443,1000-2000. Leave blank for none."
  • The UI field in frontend/src/pages/hosts/HostFormModal.tsx:262 binds correctly and the value is persisted.
  • hostToExternalProxyMap() in internal/sub/host_sub.go:45–107 converts a Host record into the endpoint map that subscription renderers consume. It maps every other host field (sni, fingerprint, alpn, pinnedPeerCertSha256, echConfigList, allowInsecure, hostHeader, path, muxParams, sockoptParams, finalMask, etc.) but never adds VlessRoute to the map.
  • Because VlessRoute never reaches the endpoint map, genVlessLink() in internal/sub/service.go:656–712 has no way to apply it. The UUID is taken verbatim from clients[clientIndex].ID (line 664) with no modification, and no routing query parameter is appended to the link.

Clarification needed on expected behavior:

The panel's own model comment and translation describe VlessRoute as a port/range spec intended to appear as a routing hint in subscription links (e.g. a routing=53,443,1000-2000 query parameter), which is how some clients interpret it. The issue report, however, states the value should be embedded directly into the UUID at the third group (xxxxxxxx-xxxx-0000-xxxx-xxxxxxxxxxxx), citing the Xray-core routing docs.

To help maintainers scope the fix correctly: which client app are you testing against, and what exact subscription output format does it expect for this field? Specifically:

  1. Should VlessRoute appear as a URL query parameter in the VLESS URI (and if so, what key name)?
  2. Or should it replace/modify specific bytes of the UUID?
  3. If UUID modification — can you share the exact Xray-core doc section or client source that describes the encoding?

The root cause (the field is stored but never emitted) is confirmed regardless of which output format is correct.

This reply was generated automatically; a maintainer may follow up.

<!-- gh-comment-id:4831933144 --> @github-actions[bot] commented on GitHub (Jun 29, 2026): The `VlessRoute` field is stored in the database but never included in any subscription output — confirmed against the current source (v3.4.1 / commit `7a5d6da`). **What the code shows:** - The field is defined in the `Host` model (`internal/database/model/model.go:777`) as `VlessRoute string`, described as a "free-form port/range routing spec (e.g. '53,443,1000-2000')". The UI hint in `internal/web/translation/en-US.json` reads: *"Ports/ranges routed via VLESS, e.g. 53,443,1000-2000. Leave blank for none."* - The UI field in `frontend/src/pages/hosts/HostFormModal.tsx:262` binds correctly and the value is persisted. - `hostToExternalProxyMap()` in `internal/sub/host_sub.go:45–107` converts a `Host` record into the endpoint map that subscription renderers consume. It maps every other host field (`sni`, `fingerprint`, `alpn`, `pinnedPeerCertSha256`, `echConfigList`, `allowInsecure`, `hostHeader`, `path`, `muxParams`, `sockoptParams`, `finalMask`, etc.) but **never adds `VlessRoute`** to the map. - Because `VlessRoute` never reaches the endpoint map, `genVlessLink()` in `internal/sub/service.go:656–712` has no way to apply it. The UUID is taken verbatim from `clients[clientIndex].ID` (line 664) with no modification, and no `routing` query parameter is appended to the link. **Clarification needed on expected behavior:** The panel's own model comment and translation describe `VlessRoute` as a port/range spec intended to appear as a routing hint in subscription links (e.g. a `routing=53,443,1000-2000` query parameter), which is how some clients interpret it. The issue report, however, states the value should be embedded directly into the UUID at the third group (`xxxxxxxx-xxxx-0000-xxxx-xxxxxxxxxxxx`), citing the Xray-core routing docs. To help maintainers scope the fix correctly: which client app are you testing against, and what exact subscription output format does it expect for this field? Specifically: 1. Should `VlessRoute` appear as a URL query parameter in the VLESS URI (and if so, what key name)? 2. Or should it replace/modify specific bytes of the UUID? 3. If UUID modification — can you share the exact Xray-core doc section or client source that describes the encoding? The root cause (the field is stored but never emitted) is confirmed regardless of which output format is correct. *This reply was generated automatically; a maintainer may follow up.*
Author
Owner

@MHSanaei commented on GitHub (Jun 29, 2026):

Fixed in d8221a81.

The Host VLESS Route field was stored and shown in the panel but never applied to subscription output. It is now baked into the per-client UUID's 3rd group (bytes 6-7, big-endian uint16) — exactly what Xray reads via net.PortFromBytes(userSentID[6:8]) — across raw, JSON and Clash subscriptions. Because Xray masks those two bytes to zero before authenticating the user (ProcessUUID), the modified UUID still authenticates while carrying the route value.

A couple of notes on the field itself:

  • It is now a single value 0–65535 (e.g. 443 → UUID 3rd group 01bb). A UUID's 3rd group holds exactly one uint16, so the previous multi-segment form (53,443,1000-2000) was incorrect for this field — that spec belongs to the separate server-side routing rule (routing.rules[].source.vlessRoute).
  • Empty / invalid / out-of-range values are left as-is (no broken links, no DB migration).

Frontend validation, the in-panel link preview, and the hint/error strings in all 13 locales were updated to match, and tests were added on every path (helper, raw, JSON, Clash, multi-host).

<!-- gh-comment-id:4832592339 --> @MHSanaei commented on GitHub (Jun 29, 2026): Fixed in `d8221a81`. The Host **VLESS Route** field was stored and shown in the panel but never applied to subscription output. It is now baked into the per-client UUID's 3rd group (bytes 6-7, big-endian uint16) — exactly what Xray reads via `net.PortFromBytes(userSentID[6:8])` — across **raw, JSON and Clash** subscriptions. Because Xray masks those two bytes to zero before authenticating the user (`ProcessUUID`), the modified UUID still authenticates while carrying the route value. A couple of notes on the field itself: - It is now a **single value `0–65535`** (e.g. `443` → UUID 3rd group `01bb`). A UUID's 3rd group holds exactly one uint16, so the previous multi-segment form (`53,443,1000-2000`) was incorrect for this field — that spec belongs to the separate server-side routing rule (`routing.rules[].source.vlessRoute`). - Empty / invalid / out-of-range values are left as-is (no broken links, no DB migration). Frontend validation, the in-panel link preview, and the hint/error strings in all 13 locales were updated to match, and tests were added on every path (helper, raw, JSON, Clash, multi-host).
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#3937
No description provided.