[GH-ISSUE #6738] [Bug]: Host serverDescription is not appended to hysteria2:// subscription links (works for VLESS) #4491

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

Originally created by @R0me0Star on GitHub (Oct 5, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6738

Describe the bug

A host with a "Description" (serverDescription) is attached to two inbounds on the same node: one VLESS (xhttp + Reality) and one Hysteria2. In the subscription output the VLESS link gets the ?serverDescription=<base64> suffix after the remark, but the hysteria2:// link for the same host does not. As a result Happ shows the custom subtitle for VLESS servers and the default "Hysteria | hysteria | TLS" for Hysteria2 servers.

Related: #6488 (added serverDescription escaping for inbound/host links), #6575 (same parameter lost for external links).

How to reproduce the problem

  1. Create a VLESS inbound (xhttp, Reality) and a Hysteria2 inbound on the same node.
  2. Open Hosts, create a host, attach BOTH inbounds to it, set Description to "Wi-Fi", enable it.
  3. Attach a client to both inbounds.
  4. Fetch the subscription with a Happ User-Agent:
    curl -s -A "Happ/3.0.0" "https:////" | base64 -d
  5. Compare the fragment (part after #) of the vless:// and hysteria2:// lines.

Expected behavior

Both links carry the host description:
vless://...#?serverDescription=V2ktRmk=
hysteria2://...#?serverDescription=V2ktRmk=

Actual behavior

Only the VLESS link has it. Fragments from the real subscription (same host, two inbounds):

%F0%9F%87%B5%F0%9F%87%B1%20%D0%9F%D0%BE%D0%BB%D1%8C%D1%88%D0%B0%20%F0%9F%8E%B5?serverDescription=V2ktRmk= <- vless
%F0%9F%87%B5%F0%9F%87%B1%20%D0%9F%D0%BE%D0%BB%D1%8C%D1%88%D0%B0%20%F0%9F%8E%B5%F0%9F%8E%AE <- hysteria2

The same happens for every host: 4 of 4 VLESS links have the parameter, 4 of 4 Hysteria2 links do not.

Relevant logs


Screenshots

No response

3x-ui version

3.9.0

Xray-core version

26.9.30

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?

No — direct access

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 @R0me0Star on GitHub (Oct 5, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6738 ### Describe the bug A host with a "Description" (serverDescription) is attached to two inbounds on the same node: one VLESS (xhttp + Reality) and one Hysteria2. In the subscription output the VLESS link gets the `?serverDescription=<base64>` suffix after the remark, but the hysteria2:// link for the same host does not. As a result Happ shows the custom subtitle for VLESS servers and the default "Hysteria | hysteria | TLS" for Hysteria2 servers. Related: #6488 (added serverDescription escaping for inbound/host links), #6575 (same parameter lost for external links). ### How to reproduce the problem 1. Create a VLESS inbound (xhttp, Reality) and a Hysteria2 inbound on the same node. 2. Open Hosts, create a host, attach BOTH inbounds to it, set Description to "Wi-Fi", enable it. 3. Attach a client to both inbounds. 4. Fetch the subscription with a Happ User-Agent: curl -s -A "Happ/3.0.0" "https://<sub-domain>/<sub-path>/<subId>" | base64 -d 5. Compare the fragment (part after #) of the vless:// and hysteria2:// lines. ### Expected behavior Both links carry the host description: vless://...#<remark>?serverDescription=V2ktRmk= hysteria2://...#<remark>?serverDescription=V2ktRmk= ### Actual behavior Only the VLESS link has it. Fragments from the real subscription (same host, two inbounds): %F0%9F%87%B5%F0%9F%87%B1%20%D0%9F%D0%BE%D0%BB%D1%8C%D1%88%D0%B0%20%F0%9F%8E%B5?serverDescription=V2ktRmk= <- vless %F0%9F%87%B5%F0%9F%87%B1%20%D0%9F%D0%BE%D0%BB%D1%8C%D1%88%D0%B0%20%F0%9F%8E%B5%F0%9F%8E%AE <- hysteria2 The same happens for every host: 4 of 4 VLESS links have the parameter, 4 of 4 Hysteria2 links do not. ### Relevant logs ```shell ``` ### Screenshots _No response_ ### 3x-ui version 3.9.0 ### Xray-core version 26.9.30 ### 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? No — direct access ### 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:40:01 +07:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@github-actions[bot] commented on GitHub (Oct 5, 2026):

This is a real bug, and it is still present on the default branch. The Hysteria/Hysteria2 link builder has its own per-endpoint loop. That loop never adds the host's serverDescription to the remark, so hysteria2:// links never get the ?serverDescription=<base64> suffix. VLESS, Trojan and Shadowsocks use a shared endpoint renderer that does add it.

The host's description does reach the Hysteria code. internal/sub/host_sub.go:113-115 copies it onto the endpoint map:

if h.ServerDescription != "" {
	ep["serverDescription"] = h.ServerDescription
}

The shared renderer that vless:// goes through then adds it to the remark, in internal/sub/endpoint.go:138-141 (buildEndpointLinks):

remark := makeRemark(e)
if e.ServerDescription != "" {
	remark = appendHappServerDescription(remark, e.ServerDescription)
}

genHysteriaLink does not use that renderer. Its own externalProxy loop builds the fragment straight from endpointRemark, which returns only the remark (internal/sub/host_sub.go:259-271). Nothing in that loop reads ep["serverDescription"]. From internal/sub/service.go:1537-1538:

link := fmt.Sprintf("%s://%s@%s", protocol, auth, joinHostPort(dest, int(portF)))
links = append(links, buildLinkWithParams(link, epParams, s.endpointRemark(inbound, email, ep, "quic")))

The fragment escaping is not the problem. buildLinkWithParams runs escapeLinkFragment (internal/sub/service.go:2366-2375), which keeps a valid ?serverDescription= tail as-is. The suffix is simply never added for Hysteria. This matches what you saw: 4 of 4 VLESS links have the parameter and 4 of 4 Hysteria2 links don't.

There is no workaround in the panel settings for Hysteria2 links in the raw subscription.

Verdict: Confirmed bug
Severity: Low
Confidence: High
Root cause: internal/sub/service.go:1538, genHysteriaLink: the per-host/externalProxy loop passes s.endpointRemark(...) as the fragment without appendHappServerDescription. Every host attached to a Hysteria (v1 or v2) inbound is affected; VLESS/Trojan/SS go through buildEndpointLinks (internal/sub/endpoint.go:138-141) and are fine.
Already fixed: Still present on the default branch (d4a7086c)
Duplicate of: Related: #6575 (a different cause: an existing ?serverDescription= was percent-encoded for external links; that fix, escapeLinkFragment, does not cover a suffix that is never added)
Evidence: internal/sub/host_sub.go:113-115 (description put on the endpoint); internal/sub/endpoint.go:138-141 (added for URL-param protocols); internal/sub/service.go:1537-1538 (Hysteria loop leaves it out); internal/sub/service.go:2364-2375 (the escaping would keep it if it were there)
Not determined: Whether other generators with their own loops (outside buildEndpointLinks / buildEndpointVmessLinks) have the same gap. A grep for callers of endpointRemark in internal/sub/ would settle it.

Suggested fix: In the genHysteriaLink externalProxy loop, pass the remark through appendHappServerDescription using ep["serverDescription"], the same way buildEndpointLinks does. A regression test in internal/sub should check that a hysteria2 host link's fragment ends in ?serverDescription=<base64>.

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

<!-- gh-comment-id:5995896370 --> @github-actions[bot] commented on GitHub (Oct 5, 2026): This is a real bug, and it is still present on the default branch. The Hysteria/Hysteria2 link builder has its own per-endpoint loop. That loop never adds the host's `serverDescription` to the remark, so `hysteria2://` links never get the `?serverDescription=<base64>` suffix. VLESS, Trojan and Shadowsocks use a shared endpoint renderer that does add it. The host's description does reach the Hysteria code. `internal/sub/host_sub.go:113-115` copies it onto the endpoint map: ```go if h.ServerDescription != "" { ep["serverDescription"] = h.ServerDescription } ``` The shared renderer that `vless://` goes through then adds it to the remark, in `internal/sub/endpoint.go:138-141` (`buildEndpointLinks`): ```go remark := makeRemark(e) if e.ServerDescription != "" { remark = appendHappServerDescription(remark, e.ServerDescription) } ``` `genHysteriaLink` does not use that renderer. Its own `externalProxy` loop builds the fragment straight from `endpointRemark`, which returns only the remark (`internal/sub/host_sub.go:259-271`). Nothing in that loop reads `ep["serverDescription"]`. From `internal/sub/service.go:1537-1538`: ```go link := fmt.Sprintf("%s://%s@%s", protocol, auth, joinHostPort(dest, int(portF))) links = append(links, buildLinkWithParams(link, epParams, s.endpointRemark(inbound, email, ep, "quic"))) ``` The fragment escaping is not the problem. `buildLinkWithParams` runs `escapeLinkFragment` (`internal/sub/service.go:2366-2375`), which keeps a valid `?serverDescription=` tail as-is. The suffix is simply never added for Hysteria. This matches what you saw: 4 of 4 VLESS links have the parameter and 4 of 4 Hysteria2 links don't. There is no workaround in the panel settings for Hysteria2 links in the raw subscription. Verdict: Confirmed bug Severity: Low Confidence: High Root cause: `internal/sub/service.go:1538`, `genHysteriaLink`: the per-host/externalProxy loop passes `s.endpointRemark(...)` as the fragment without `appendHappServerDescription`. Every host attached to a Hysteria (v1 or v2) inbound is affected; VLESS/Trojan/SS go through `buildEndpointLinks` (`internal/sub/endpoint.go:138-141`) and are fine. Already fixed: Still present on the default branch (`d4a7086c`) Duplicate of: Related: #6575 (a different cause: an existing `?serverDescription=` was percent-encoded for external links; that fix, `escapeLinkFragment`, does not cover a suffix that is never added) Evidence: `internal/sub/host_sub.go:113-115` (description put on the endpoint); `internal/sub/endpoint.go:138-141` (added for URL-param protocols); `internal/sub/service.go:1537-1538` (Hysteria loop leaves it out); `internal/sub/service.go:2364-2375` (the escaping would keep it if it were there) Not determined: Whether other generators with their own loops (outside `buildEndpointLinks` / `buildEndpointVmessLinks`) have the same gap. A grep for callers of `endpointRemark` in `internal/sub/` would settle it. Suggested fix: In the `genHysteriaLink` externalProxy loop, pass the remark through `appendHappServerDescription` using `ep["serverDescription"]`, the same way `buildEndpointLinks` does. A regression test in `internal/sub` should check that a hysteria2 host link's fragment ends in `?serverDescription=<base64>`. *This reply was generated automatically; a maintainer may follow up.* <!-- claude-issue:analyst -->
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#4491
No description provided.