[GH-ISSUE #5473] [Bug]: No ALPN set in subscriptions / client outputs #3826

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

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

Describe the bug

Version: 3.3.1
Configurations affected: vless xhttp-tls / ws-tls

How to reproduce the problem

  1. Make an inbound xhttp-tls or ws-tls
  2. Select ALPN (any combination of 1.1 / 2 /3)
  3. Create client bind to inbound
  4. Click on QR code button
  5. Use subscription in any V2Ray client (v2rayng / v2rayN / etc)
  6. View configuration settings
  7. No ALPN set

Alternatively,
5. Copy v2ray configuration text
6. No ALPN set in output

Expected behavior

ALPN set in subscription page
ALPN set in v2ray configuration text

Actual behavior

No ALPN set in client subscription page / configuration output

Relevant logs


Screenshots

Image

3x-ui version

3.3.1

Xray-core version

No response

How did you install 3x-ui?

install.sh script

Operating system

Ubuntu 26

Which parts of the panel are affected?

No response

Browser (only if it is a UI bug)

No response

Is the panel behind a reverse proxy or CDN?

None

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 @arashvenus70 on GitHub (Jun 21, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5473 ### Describe the bug Version: 3.3.1 Configurations affected: vless xhttp-tls / ws-tls ### How to reproduce the problem 1. Make an inbound xhttp-tls or ws-tls 2. Select ALPN (any combination of 1.1 / 2 /3) 3. Create client bind to inbound 4. Click on QR code button 5. Use subscription in any V2Ray client (v2rayng / v2rayN / etc) 6. View configuration settings 7. No ALPN set Alternatively, 5. Copy v2ray configuration text 6. No ALPN set in output ### Expected behavior ALPN set in subscription page ALPN set in v2ray configuration text ### Actual behavior No ALPN set in client subscription page / configuration output ### Relevant logs ```shell ``` ### Screenshots <img width="1057" height="326" alt="Image" src="https://github.com/user-attachments/assets/1e428df5-28b7-48ce-9395-3c0399cdc456" /> ### 3x-ui version 3.3.1 ### Xray-core version _No response_ ### How did you install 3x-ui? install.sh script ### Operating system Ubuntu 26 ### Which parts of the panel are affected? _No response_ ### Browser (only if it is a UI bug) _No response_ ### Is the panel behind a reverse proxy or CDN? None ### 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:14 +07:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

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

Traced this through both output paths. The subscription service and the panel share link generator both handle ALPN correctly — but only when tlsSettings.alpn in the stored streamSettings JSON is a non-empty array. The bug is almost certainly upstream of the link generators: the ALPN values are not reaching the database.

What the code does

applyShareTLSParams (internal/sub/service.go, around line 1101) reads stream["tlsSettings"]["alpn"].([]any), joins with a comma, and sets params["alpn"] — but only if the resulting slice is non-empty. This function is transport-agnostic; the same code path is reached whether the network is tcp, ws, or xhttp. The frontend panel link generator (frontend/src/lib/xray/inbound-link.ts, genVlessLink) always sets alpn=tls.alpn.join(',') when security === 'tls', regardless of transport, so an empty array there produces alpn= (empty string) rather than omitting the param entirely.

Both paths produce correct output when the stored JSON contains "alpn": ["h2","http/1.1"]. Both produce no useful ALPN output when it contains "alpn": [] or no alpn key at all.

Coverage gap

Every existing test fixture that uses xhttp+TLS or ws+TLS omits alpn from the tlsSettings object (see json_service_test.go lines 183 and 229, host_sub_test.go line 57). A regression specific to xhttp+TLS+ALPN or ws+TLS+ALPN in the link generators would not be caught by the current test suite.

Diagnostics needed

To confirm where the value is lost, please provide:

  1. The raw stream_settings JSON stored for an affected inbound. On a SQLite installation: sqlite3 /etc/x-ui/x-ui.db "SELECT stream_settings FROM inbounds WHERE id = <id>;". On PostgreSQL, the equivalent SELECT. Look for the tlsSettings.alpn array — if it is [] or absent, the form submission is not persisting the selected values.

  2. Whether the inbound was newly created on v3.3.1 or migrated/imported from an older version. Legacy inbounds may not have alpn in their stored JSON at all.

  3. A verbatim copy of one subscription URL (or panel share link) from an affected inbound, so we can confirm whether alpn is absent entirely or present as an empty string.

If the stored JSON shows "alpn": ["h2","http/1.1"] (or whichever values were selected) but the subscription URL still lacks it, that would point to the link generator and the characterization test gap above becomes the focus for a fix.


I'm an automated triage assistant. A maintainer will follow up.

<!-- gh-comment-id:4762821284 --> @github-actions[bot] commented on GitHub (Jun 21, 2026): Traced this through both output paths. The subscription service and the panel share link generator both handle ALPN correctly — but only when `tlsSettings.alpn` in the stored `streamSettings` JSON is a non-empty array. The bug is almost certainly upstream of the link generators: the ALPN values are not reaching the database. **What the code does** `applyShareTLSParams` (`internal/sub/service.go`, around line 1101) reads `stream["tlsSettings"]["alpn"].([]any)`, joins with a comma, and sets `params["alpn"]` — but only if the resulting slice is non-empty. This function is transport-agnostic; the same code path is reached whether the network is `tcp`, `ws`, or `xhttp`. The frontend panel link generator (`frontend/src/lib/xray/inbound-link.ts`, `genVlessLink`) always sets `alpn=tls.alpn.join(',')` when `security === 'tls'`, regardless of transport, so an empty array there produces `alpn=` (empty string) rather than omitting the param entirely. Both paths produce correct output when the stored JSON contains `"alpn": ["h2","http/1.1"]`. Both produce no useful ALPN output when it contains `"alpn": []` or no `alpn` key at all. **Coverage gap** Every existing test fixture that uses `xhttp`+TLS or `ws`+TLS omits `alpn` from the `tlsSettings` object (see `json_service_test.go` lines 183 and 229, `host_sub_test.go` line 57). A regression specific to xhttp+TLS+ALPN or ws+TLS+ALPN in the link generators would not be caught by the current test suite. **Diagnostics needed** To confirm where the value is lost, please provide: 1. The raw `stream_settings` JSON stored for an affected inbound. On a SQLite installation: `sqlite3 /etc/x-ui/x-ui.db "SELECT stream_settings FROM inbounds WHERE id = <id>;"`. On PostgreSQL, the equivalent `SELECT`. Look for the `tlsSettings.alpn` array — if it is `[]` or absent, the form submission is not persisting the selected values. 2. Whether the inbound was newly created on v3.3.1 or migrated/imported from an older version. Legacy inbounds may not have `alpn` in their stored JSON at all. 3. A verbatim copy of one subscription URL (or panel share link) from an affected inbound, so we can confirm whether `alpn` is absent entirely or present as an empty string. If the stored JSON shows `"alpn": ["h2","http/1.1"]` (or whichever values were selected) but the subscription URL still lacks it, that would point to the link generator and the characterization test gap above becomes the focus for a fix. --- *I'm an automated triage assistant. A maintainer will follow up.*
Author
Owner

@arashvenus70 commented on GitHub (Jun 21, 2026):

Upon double checking, it seems the problem is on the client side.

ALPN is fully present in config output text & subscription page.

<!-- gh-comment-id:4762929981 --> @arashvenus70 commented on GitHub (Jun 21, 2026): Upon double checking, it seems the problem is on the client side. ALPN is fully present in config output text & subscription page.
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#3826
No description provided.