[GH-ISSUE #6982] Bug Report: ALPN settings defined in Hosts are not applied to V2RayN subscriptions #4604

Closed
opened 2026-10-31 20:40:50 +07:00 by bsakaguchi · 5 comments
Owner

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

Describe the bug

When I configure the alpn parameter for a configuration in the Hosts section of the Sanaei panel, the ALPN setting does not appear to be applied when I export or update the subscription in V2RayN.

How to reproduce the problem

1-Open the Sanaei panel.
2-Navigate to the Hosts section.
3-Configure the alpn parameter for a host associated with an inbound.
4-update the subscription.
5-refresh the subscription in V2RayN.
6-Check the configuration of the corresponding node in V2RayN.

Expected behavior

The ALPN value configured in the Hosts section should be correctly included in the generated subscription and applied to the corresponding node in V2RayN.

Actual behavior

The ALPN value configured in the Hosts section does not appear to be applied to the node in V2RayN after importing or updating the subscription.

Relevant logs


Screenshots

No response

3x-ui version

3.11.0

Xray-core version

26.10.21

How did you install 3x-ui?

install.sh script

Operating system

ubuntu 20.04

Which parts of the panel are affected?

Xray config generation

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 @sinath72 on GitHub (Oct 27, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6982 ### Describe the bug When I configure the alpn parameter for a configuration in the Hosts section of the Sanaei panel, the ALPN setting does not appear to be applied when I export or update the subscription in V2RayN. ### How to reproduce the problem 1-Open the Sanaei panel. 2-Navigate to the Hosts section. 3-Configure the alpn parameter for a host associated with an inbound. 4-update the subscription. 5-refresh the subscription in V2RayN. 6-Check the configuration of the corresponding node in V2RayN. ### Expected behavior The ALPN value configured in the Hosts section should be correctly included in the generated subscription and applied to the corresponding node in V2RayN. ### Actual behavior The ALPN value configured in the Hosts section does not appear to be applied to the node in V2RayN after importing or updating the subscription. ### Relevant logs ```shell ``` ### Screenshots _No response_ ### 3x-ui version 3.11.0 ### Xray-core version 26.10.21 ### How did you install 3x-ui? install.sh script ### Operating system ubuntu 20.04 ### Which parts of the panel are affected? Xray config generation ### 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:40:50 +07:00
  • closed this issue
  • added the
    question
    label
Author
Owner

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

I could not reproduce a general failure in the source. A Host's ALPN is written into the raw (V2RayN) subscription link, but only when that endpoint's effective security is tls. There are two configurations where the panel drops it on purpose, and both fit this report. I need a few details to tell which one you hit (list at the end).

How the Host ALPN reaches the link. hostToExternalProxyMap copies it onto the endpoint (internal/sub/host_sub.go:252-253):

if len(h.Alpn) > 0 {
	ep["alpn"] = stringsToAnySlice(h.Alpn)
}

For VLESS, Trojan, Shadowsocks and VMess, buildEndpointLinks (internal/sub/endpoint.go:127-133) works out the endpoint's security. The Host's Security setting wins, unless it is "same", in which case the inbound's own security is used. The ALPN is then applied only for TLS (internal/sub/service.go:2205-2217):

func applyExternalProxyTLSParams(ep map[string]any, params map[string]string, security string) {
	if security != "tls" {
		return
	}
	...
	if alpn, ok := externalProxyALPN(ep["alpn"]); ok {
		params["alpn"] = alpn
	}

TestChar_C1_VlessExternalProxy (internal/sub/characterization_test.go:35-48) pins the working case: an endpoint with forceTls: tls and alpn: ["h3","h2"] produces ...?alpn=h3%2Ch2&...&security=tls....

Case 1 (likely behind Nginx). If the inbound's Security is none because Nginx terminates TLS, and the Host's Security is left on "Same as inbound", the link is rendered with security=none. The ALPN, SNI and fingerprint are then all dropped. The Host form still shows the ALPN field in that state (frontend/src/pages/hosts/HostFormModal.tsx:128: const showTlsExtras = security === 'tls' || security === 'same';). That is why it looks as if it should apply.
Workaround: set the Host's Security to TLS. The link then carries security=tls together with your alpn, sni and fp.

Case 2 (Hysteria inbounds). genHysteriaLink does not use the shared TLS override path. It applies only the cert pin and insecure from each Host (internal/sub/service.go:1638, applyExternalProxyHysteriaParams). Its comment at internal/sub/service.go:2235-2237 says this is intentional: "sni/fp/alpn are left as the inbound's own". So the inbound's ALPN is used, not the Host's.

To settle this, please reply with:

  1. The inbound's protocol and transport, for example VLESS + WS or XHTTP, or Hysteria2.
  2. The inbound's Security value (none, tls or reality), and the Host's Security value ("Same", TLS or None).
  3. The ALPN values you selected on the Host.
  4. The exact link line for that Host from your raw subscription URL (open it in a browser and base64-decode it if needed), with the UUID and domain redacted. It shows whether alpn= is missing from what the panel serves or whether V2RayN is not applying it.
Verdict:        Insufficient information
Severity:       N/A
Confidence:     Medium
Root cause:     Not established. The Host ALPN is emitted when the endpoint's effective security is tls (internal/sub/service.go:2205-2217). It is dropped when that security resolves to none or reality (Host Security "same" on a non-TLS inbound) and for Hysteria (internal/sub/service.go:2235-2238, by design).
Same class:     None found
Already fixed:  Not applicable
Duplicate of:   None
Evidence:       internal/sub/host_sub.go:252-253; internal/sub/endpoint.go:127-133; internal/sub/service.go:2205-2217, 2235-2238; TestChar_C1_VlessExternalProxy (internal/sub/characterization_test.go:35); HostFormModal.tsx:128 shows ALPN when Security is "same"
Not determined: Which protocol, inbound security and Host security the reporter uses. The raw link line from the subscription settles it.

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

<!-- gh-comment-id:6439370447 --> @github-actions[bot] commented on GitHub (Oct 27, 2026): I could not reproduce a general failure in the source. A Host's ALPN **is** written into the raw (V2RayN) subscription link, but only when that endpoint's effective security is `tls`. There are two configurations where the panel drops it on purpose, and both fit this report. I need a few details to tell which one you hit (list at the end). **How the Host ALPN reaches the link.** `hostToExternalProxyMap` copies it onto the endpoint (`internal/sub/host_sub.go:252-253`): ```go if len(h.Alpn) > 0 { ep["alpn"] = stringsToAnySlice(h.Alpn) } ``` For VLESS, Trojan, Shadowsocks and VMess, `buildEndpointLinks` (`internal/sub/endpoint.go:127-133`) works out the endpoint's security. The Host's **Security** setting wins, unless it is "same", in which case the inbound's own security is used. The ALPN is then applied only for TLS (`internal/sub/service.go:2205-2217`): ```go func applyExternalProxyTLSParams(ep map[string]any, params map[string]string, security string) { if security != "tls" { return } ... if alpn, ok := externalProxyALPN(ep["alpn"]); ok { params["alpn"] = alpn } ``` `TestChar_C1_VlessExternalProxy` (`internal/sub/characterization_test.go:35-48`) pins the working case: an endpoint with `forceTls: tls` and `alpn: ["h3","h2"]` produces `...?alpn=h3%2Ch2&...&security=tls...`. **Case 1 (likely behind Nginx).** If the inbound's Security is `none` because Nginx terminates TLS, and the Host's Security is left on "Same as inbound", the link is rendered with `security=none`. The ALPN, SNI and fingerprint are then all dropped. The Host form still shows the ALPN field in that state (`frontend/src/pages/hosts/HostFormModal.tsx:128`: `const showTlsExtras = security === 'tls' || security === 'same';`). That is why it looks as if it should apply. **Workaround:** set the Host's **Security** to `TLS`. The link then carries `security=tls` together with your `alpn`, `sni` and `fp`. **Case 2 (Hysteria inbounds).** `genHysteriaLink` does not use the shared TLS override path. It applies only the cert pin and `insecure` from each Host (`internal/sub/service.go:1638`, `applyExternalProxyHysteriaParams`). Its comment at `internal/sub/service.go:2235-2237` says this is intentional: "sni/fp/alpn are left as the inbound's own". So the inbound's ALPN is used, not the Host's. **To settle this, please reply with:** 1. The inbound's protocol and transport, for example VLESS + WS or XHTTP, or Hysteria2. 2. The inbound's **Security** value (`none`, `tls` or `reality`), and the Host's **Security** value ("Same", `TLS` or `None`). 3. The ALPN values you selected on the Host. 4. The exact link line for that Host from your raw subscription URL (open it in a browser and base64-decode it if needed), with the UUID and domain redacted. It shows whether `alpn=` is missing from what the panel serves or whether V2RayN is not applying it. ``` Verdict: Insufficient information Severity: N/A Confidence: Medium Root cause: Not established. The Host ALPN is emitted when the endpoint's effective security is tls (internal/sub/service.go:2205-2217). It is dropped when that security resolves to none or reality (Host Security "same" on a non-TLS inbound) and for Hysteria (internal/sub/service.go:2235-2238, by design). Same class: None found Already fixed: Not applicable Duplicate of: None Evidence: internal/sub/host_sub.go:252-253; internal/sub/endpoint.go:127-133; internal/sub/service.go:2205-2217, 2235-2238; TestChar_C1_VlessExternalProxy (internal/sub/characterization_test.go:35); HostFormModal.tsx:128 shows ALPN when Security is "same" Not determined: Which protocol, inbound security and Host security the reporter uses. The raw link line from the subscription settles it. ``` *This reply was generated automatically; a maintainer may follow up.* <!-- claude-issue:analyst -->
Author
Owner

@sinath72 commented on GitHub (Oct 27, 2026):

Thanks for the detailed investigation.

Here are the details of my setup:

1. Inbound protocols and transports

I have multiple inbounds using the following protocols:

  • VLESS
  • VMess
  • Trojan

I have separate inbounds using each of these transports:

  • WebSocket (WS)
  • HTTPUpgrade
  • XHTTP
  • gRPC

2. Security configuration

  • Inbound Security: none (TLS is disabled on the inbounds).
  • Host Security: TLS.

All inbounds use non-standard backend ports, such as 100, 200, and other ports.

3. Reverse proxy and CDN setup

My setup is:

V2RayN → Cloudflare CDN → Nginx → Backend inbound

Nginx handles the TLS connection, and my configuration uses Cloudflare-supported ports. The subscription endpoint is also served through Cloudflare and Nginx.

4. ALPN configuration

I configured ALPN values in the Hosts section and tested all available ALPN options. However, the configured ALPN values are not applied to the corresponding nodes in V2RayN after importing or updating the subscription.

The Host Security is explicitly set to TLS, not Same as inbound, so the first scenario described in your response should not apply.

Questions

  1. Could this be related to how the subscription generator handles ALPN for different protocols and transports when TLS is terminated by an external reverse proxy?
  2. Is ALPN expected to be included in the generated subscription for all supported combinations of VLESS, VMess, and Trojan with WS, HTTPUpgrade, XHTTP, and gRPC?
  3. Could you investigate whether the ALPN parameter is correctly serialized into the raw subscription output for these configurations?

I can provide the decoded subscription links with sensitive information redacted if needed.

Thank you.

<!-- gh-comment-id:6450575966 --> @sinath72 commented on GitHub (Oct 27, 2026): Thanks for the detailed investigation. Here are the details of my setup: **1. Inbound protocols and transports** I have multiple inbounds using the following protocols: - VLESS - VMess - Trojan I have separate inbounds using each of these transports: - WebSocket (WS) - HTTPUpgrade - XHTTP - gRPC **2. Security configuration** - Inbound Security: `none` (TLS is disabled on the inbounds). - Host Security: `TLS`. All inbounds use non-standard backend ports, such as `100`, `200`, and other ports. **3. Reverse proxy and CDN setup** My setup is: `V2RayN → Cloudflare CDN → Nginx → Backend inbound` Nginx handles the TLS connection, and my configuration uses Cloudflare-supported ports. The subscription endpoint is also served through Cloudflare and Nginx. **4. ALPN configuration** I configured ALPN values in the Hosts section and tested all available ALPN options. However, the configured ALPN values are not applied to the corresponding nodes in V2RayN after importing or updating the subscription. The Host Security is explicitly set to `TLS`, not `Same as inbound`, so the first scenario described in your response should not apply. **Questions** 1. Could this be related to how the subscription generator handles ALPN for different protocols and transports when TLS is terminated by an external reverse proxy? 2. Is ALPN expected to be included in the generated subscription for all supported combinations of VLESS, VMess, and Trojan with WS, HTTPUpgrade, XHTTP, and gRPC? 3. Could you investigate whether the ALPN parameter is correctly serialized into the raw subscription output for these configurations? I can provide the decoded subscription links with sensitive information redacted if needed. Thank you.
Author
Owner

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

Thanks, that rules out the "Same as inbound" case. With the inbound on none and the Host on TLS, I traced VLESS, VMess and Trojan through the raw subscription code, and the panel does write the Host's ALPN into the link for every transport you listed (WS, HTTPUpgrade, XHTTP, gRPC). So the source doesn't explain what you're seeing. The one thing that can settle it is the decoded link line you offered. Please post it.

Your three questions, answered from the source

  1. Does TLS terminating on Nginx matter? No. The generator doesn't know about Nginx. It only uses the Host's Security setting. hostToExternalProxyMap stores your TLS choice as forceTls: "tls" (internal/sub/host_sub.go:230). buildEndpointLinks then lets that override the inbound's none (internal/sub/endpoint.go:127-133):
    if e.ForceTls != "same" {
    	securityToApply = e.ForceTls
    }
    ...
    applyEndpointTLSParams(e, nextParams, securityToApply)
    
    With securityToApply == "tls", applyExternalProxyTLSParams adds the ALPN (internal/sub/service.go:2205-2217): params["alpn"] = alpn.
  2. All protocol and transport combinations? Yes, for these three protocols.
    • VLESS (genVlessLink) and Trojan (genTrojanLink) both use the URL-parameter path above.
    • VMess uses buildEndpointVmessLinks. It sets "tls" to the Host value and calls applyExternalProxyTLSObj, which writes obj["alpn"] (internal/sub/endpoint.go:165-179, internal/sub/service.go:2188-2189).
    • The transport never decides whether ALPN is written. The only code that strips ALPN runs when the effective security is none (internal/sub/service.go:2171, and omitTLSFields in appendQueryAndFragment).
    • The JSON subscription behaves the same way. It switches the stream to TLS (internal/sub/json_service.go:682-686) and sets tlsSettings["alpn"] (internal/sub/service.go:2300-2301).
  3. Is ALPN serialized? Yes. Several selections are joined with commas into one alpn= value (externalProxyALPN, internal/sub/service.go:2354). TestChar_C1_VlessExternalProxy (internal/sub/characterization_test.go:35) pins alpn=h3%2Ch2 together with security=tls.

The panel also sends Cache-Control: no-cache, no-store, must-revalidate on subscription responses (internal/sub/controller.go:765). Even so, Cloudflare in front of the subscription URL could still serve an older copy if a Cache Rule there overrides that header. This is an inference I can't check from the source.

Please reply with:

  1. One decoded line from your raw subscription for an affected node, fetched directly with curl or a browser rather than taken from V2RayN, with the UUID or password and the domain redacted. If you can, include one VLESS line and one VMess line (VMess lines are base64 JSON, so decode those too).
  2. Whether that line contains alpn= (or "alpn" for VMess).

If alpn= is there, the panel is producing the right output, and the problem is in how V2RayN shows or uses it. If it is missing, something is going wrong between the Host settings and the link. The exact line will show where.

Verdict:        Insufficient information
Severity:       N/A
Confidence:     Medium
Root cause:     None found in source. For VLESS/VMess/Trojan with inbound security none and Host Security tls, ALPN is emitted on every transport (internal/sub/endpoint.go:127-133, 165-179; internal/sub/service.go:2205-2217, 2188-2189).
Same class:     None found
Already fixed:  Not applicable
Duplicate of:   None
Evidence:       host_sub.go:230 forceTls from Host.Security; host_sub.go:252-253 copies Host.Alpn; host_sub.go:418 (linkFromHosts) injects Host entries into externalProxy before GetLink; endpoint.go:127-133 Host forceTls overrides inbound security; service.go:2215-2216 params["alpn"]; json_service.go:682-686 + service.go:2300-2301 for JSON; TestChar_C1_VlessExternalProxy (characterization_test.go:35)
Not determined: Whether the served subscription line actually lacks alpn=. The reporter's decoded raw line settles it.

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

<!-- gh-comment-id:6450624388 --> @github-actions[bot] commented on GitHub (Oct 27, 2026): Thanks, that rules out the "Same as inbound" case. With the inbound on `none` and the Host on `TLS`, I traced VLESS, VMess and Trojan through the raw subscription code, and the panel **does** write the Host's ALPN into the link for every transport you listed (WS, HTTPUpgrade, XHTTP, gRPC). So the source doesn't explain what you're seeing. The one thing that can settle it is the decoded link line you offered. Please post it. **Your three questions, answered from the source** 1. **Does TLS terminating on Nginx matter?** No. The generator doesn't know about Nginx. It only uses the Host's Security setting. `hostToExternalProxyMap` stores your `TLS` choice as `forceTls: "tls"` (`internal/sub/host_sub.go:230`). `buildEndpointLinks` then lets that override the inbound's `none` (`internal/sub/endpoint.go:127-133`): ```go if e.ForceTls != "same" { securityToApply = e.ForceTls } ... applyEndpointTLSParams(e, nextParams, securityToApply) ``` With `securityToApply == "tls"`, `applyExternalProxyTLSParams` adds the ALPN (`internal/sub/service.go:2205-2217`): `params["alpn"] = alpn`. 2. **All protocol and transport combinations?** Yes, for these three protocols. - VLESS (`genVlessLink`) and Trojan (`genTrojanLink`) both use the URL-parameter path above. - VMess uses `buildEndpointVmessLinks`. It sets `"tls"` to the Host value and calls `applyExternalProxyTLSObj`, which writes `obj["alpn"]` (`internal/sub/endpoint.go:165-179`, `internal/sub/service.go:2188-2189`). - The transport never decides whether ALPN is written. The only code that strips ALPN runs when the effective security is `none` (`internal/sub/service.go:2171`, and `omitTLSFields` in `appendQueryAndFragment`). - The JSON subscription behaves the same way. It switches the stream to TLS (`internal/sub/json_service.go:682-686`) and sets `tlsSettings["alpn"]` (`internal/sub/service.go:2300-2301`). 3. **Is ALPN serialized?** Yes. Several selections are joined with commas into one `alpn=` value (`externalProxyALPN`, `internal/sub/service.go:2354`). `TestChar_C1_VlessExternalProxy` (`internal/sub/characterization_test.go:35`) pins `alpn=h3%2Ch2` together with `security=tls`. The panel also sends `Cache-Control: no-cache, no-store, must-revalidate` on subscription responses (`internal/sub/controller.go:765`). Even so, Cloudflare in front of the subscription URL could still serve an older copy if a Cache Rule there overrides that header. This is an inference I can't check from the source. **Please reply with:** 1. One decoded line from your raw subscription for an affected node, fetched directly with `curl` or a browser rather than taken from V2RayN, with the UUID or password and the domain redacted. If you can, include one VLESS line and one VMess line (VMess lines are base64 JSON, so decode those too). 2. Whether that line contains `alpn=` (or `"alpn"` for VMess). If `alpn=` is there, the panel is producing the right output, and the problem is in how V2RayN shows or uses it. If it is missing, something is going wrong between the Host settings and the link. The exact line will show where. ``` Verdict: Insufficient information Severity: N/A Confidence: Medium Root cause: None found in source. For VLESS/VMess/Trojan with inbound security none and Host Security tls, ALPN is emitted on every transport (internal/sub/endpoint.go:127-133, 165-179; internal/sub/service.go:2205-2217, 2188-2189). Same class: None found Already fixed: Not applicable Duplicate of: None Evidence: host_sub.go:230 forceTls from Host.Security; host_sub.go:252-253 copies Host.Alpn; host_sub.go:418 (linkFromHosts) injects Host entries into externalProxy before GetLink; endpoint.go:127-133 Host forceTls overrides inbound security; service.go:2215-2216 params["alpn"]; json_service.go:682-686 + service.go:2300-2301 for JSON; TestChar_C1_VlessExternalProxy (characterization_test.go:35) Not determined: Whether the served subscription line actually lacks alpn=. The reporter's decoded raw line settles it. ``` *This reply was generated automatically; a maintainer may follow up.* <!-- claude-issue:analyst -->
Author
Owner

@sinath72 commented on GitHub (Oct 27, 2026):

Environment

  • Panel: Sanaei (3x-ui)
  • Client: V2RayN 7.25.6 (x64)
  • Protocols: VLESS, VMess, Trojan
  • Transports: WebSocket (WS), HTTPUpgrade, XHTTP, gRPC
  • CDN: Cloudflare
  • Reverse proxy: Nginx

Description

I configured ALPN values in the Hosts section of the Sanaei panel. The Host Security is explicitly set to TLS, while TLS is disabled on the inbounds (security: none).

My setup uses Cloudflare and Nginx as reverse proxies, with TLS terminated before traffic reaches the backend inbounds. The inbounds use non-standard backend ports, while the client-facing connections use Cloudflare-supported ports.

The ALPN parameter is present in the raw subscription output for VLESS, VMess, and Trojan. However, when I open the imported VLESS node in V2RayN 7.25.6, the ALPN field appears empty in the node's edit dialog.

I would like to determine whether this is a V2RayN subscription parsing issue, an incompatibility in the generated link format, or another configuration-related problem.

Steps to Reproduce

  1. Configure a Host in the Sanaei panel.
  2. Set Host Security to TLS.
  3. Configure ALPN values such as h2, http/1.1, and h3.
  4. Generate or update the subscription.
  5. Import or refresh the subscription in V2RayN 7.25.6.
  6. Open an affected node's edit dialog and inspect the ALPN field.

Expected Behavior

The ALPN values configured in Hosts should be preserved when the subscription is imported into V2RayN and should appear in the corresponding node configuration.

Actual Behavior

The raw subscription contains the ALPN parameter, but the ALPN field appears empty in the V2RayN node editor.

The following examples are taken from the raw subscription output. Credentials have been redacted where applicable.

1. VLESS + WebSocket

vless://<REDACTED_UUID>@xxxxx:55555?alpn=h2%2Chttp%2F1.1%2Ch3&ech=cloudflare-ech.com%2Budp%3A%2F%2F1.1.1.1&encryption=none&fp=chrome&host=as.zerooping.ir&path=%2Fauth&security=tls&type=ws#test%20cdn-%5BECH%5D%20443

The ALPN parameter is present:

alpn=h2%2Chttp%2F1.1%2Ch3

Decoded value:

h2,http/1.1,h3

2. VMess + WebSocket

The VMess subscription link contains a Base64-encoded JSON configuration. After decoding, the relevant fields are:

{
  "alpn": "h2,http/1.1,h3",
  "ech": "https://8.8.8.8/dns-query",
  "fp": "chrome",
  "host": "as.zerooping.ir",
  "net": "ws",
  "path": "/wpPlugins",
  "port": 443,
  "tls": "tls",
  "type": "none",
  "v": "2"
}

The UUID and address fields have been omitted or redacted where appropriate.

3. Trojan + WebSocket

trojan://<REDACTED_PASSWORD>@188.114.98.0:443?alpn=http%2F1.1%2Ch2%2Ch3&fp=chrome&host=as.zerooping.ir&path=%2Floginctrl&security=tls&type=ws#trojan%20cdn-%5BIRANCELL%20Clean%20IP%5D%20443

The ALPN parameter is present:

alpn=http%2F1.1%2Ch2%2Ch3

Decoded value:

http/1.1,h2,h3

Questions

  1. Why does the ALPN field appear empty in V2RayN 7.25.6 when the raw subscription contains the ALPN parameter?
  2. Does V2RayN support importing multiple ALPN values from VLESS and Trojan URI parameters and VMess JSON configurations?
  3. Is the generated subscription format compatible with V2RayN's current ALPN parsing implementation?
  4. Could you investigate whether the issue is caused by the subscription parser, the node editor, or the configuration conversion process?

I can provide additional examples for HTTPUpgrade, XHTTP, and gRPC if needed.

Thank you.

Image
<!-- gh-comment-id:6451163942 --> @sinath72 commented on GitHub (Oct 27, 2026): ### Bug Report: Host ALPN is present in subscription links but missing in V2RayN node settings **Environment** - Panel: Sanaei (3x-ui) - Client: V2RayN 7.25.6 (x64) - Protocols: VLESS, VMess, Trojan - Transports: WebSocket (WS), HTTPUpgrade, XHTTP, gRPC - CDN: Cloudflare - Reverse proxy: Nginx ### Description I configured ALPN values in the Hosts section of the Sanaei panel. The Host Security is explicitly set to `TLS`, while TLS is disabled on the inbounds (`security: none`). My setup uses Cloudflare and Nginx as reverse proxies, with TLS terminated before traffic reaches the backend inbounds. The inbounds use non-standard backend ports, while the client-facing connections use Cloudflare-supported ports. The ALPN parameter is present in the raw subscription output for VLESS, VMess, and Trojan. However, when I open the imported VLESS node in V2RayN 7.25.6, the ALPN field appears empty in the node's edit dialog. I would like to determine whether this is a V2RayN subscription parsing issue, an incompatibility in the generated link format, or another configuration-related problem. ### Steps to Reproduce 1. Configure a Host in the Sanaei panel. 2. Set Host Security to `TLS`. 3. Configure ALPN values such as `h2`, `http/1.1`, and `h3`. 4. Generate or update the subscription. 5. Import or refresh the subscription in V2RayN 7.25.6. 6. Open an affected node's edit dialog and inspect the ALPN field. ### Expected Behavior The ALPN values configured in Hosts should be preserved when the subscription is imported into V2RayN and should appear in the corresponding node configuration. ### Actual Behavior The raw subscription contains the ALPN parameter, but the ALPN field appears empty in the V2RayN node editor. ### Example Subscription Links The following examples are taken from the raw subscription output. Credentials have been redacted where applicable. **1. VLESS + WebSocket** ```text vless://<REDACTED_UUID>@xxxxx:55555?alpn=h2%2Chttp%2F1.1%2Ch3&ech=cloudflare-ech.com%2Budp%3A%2F%2F1.1.1.1&encryption=none&fp=chrome&host=as.zerooping.ir&path=%2Fauth&security=tls&type=ws#test%20cdn-%5BECH%5D%20443 ``` The ALPN parameter is present: `alpn=h2%2Chttp%2F1.1%2Ch3` Decoded value: `h2,http/1.1,h3` **2. VMess + WebSocket** The VMess subscription link contains a Base64-encoded JSON configuration. After decoding, the relevant fields are: ```json { "alpn": "h2,http/1.1,h3", "ech": "https://8.8.8.8/dns-query", "fp": "chrome", "host": "as.zerooping.ir", "net": "ws", "path": "/wpPlugins", "port": 443, "tls": "tls", "type": "none", "v": "2" } ``` The UUID and address fields have been omitted or redacted where appropriate. **3. Trojan + WebSocket** ```text trojan://<REDACTED_PASSWORD>@188.114.98.0:443?alpn=http%2F1.1%2Ch2%2Ch3&fp=chrome&host=as.zerooping.ir&path=%2Floginctrl&security=tls&type=ws#trojan%20cdn-%5BIRANCELL%20Clean%20IP%5D%20443 ``` The ALPN parameter is present: `alpn=http%2F1.1%2Ch2%2Ch3` Decoded value: `http/1.1,h2,h3` ### Questions 1. Why does the ALPN field appear empty in V2RayN 7.25.6 when the raw subscription contains the ALPN parameter? 2. Does V2RayN support importing multiple ALPN values from VLESS and Trojan URI parameters and VMess JSON configurations? 3. Is the generated subscription format compatible with V2RayN's current ALPN parsing implementation? 4. Could you investigate whether the issue is caused by the subscription parser, the node editor, or the configuration conversion process? I can provide additional examples for HTTPUpgrade, XHTTP, and gRPC if needed. Thank you. <img width="1920" height="1080" alt="Image" src="https://github.com/user-attachments/assets/ec08e8b7-5680-4ba5-8330-0b8091888833" />
Author
Owner

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

The links you posted show that 3x-ui is producing correct output. Every one of them contains the Host's ALPN together with security=tls (or "tls": "tls" for VMess). So the panel is not losing the value. It is being lost when V2RayN imports the link or shows it in the editor, and only V2RayN can fix that. I'm closing this as not a 3x-ui defect.

What the panel sends. Your three lines carry exactly what the subscription code is written to emit for a Host with Security TLS:

  • VLESS: alpn=h2%2Chttp%2F1.1%2Ch3 and security=tls
  • Trojan: alpn=http%2F1.1%2Ch2%2Ch3 and security=tls
  • VMess: "alpn": "h2,http/1.1,h3" and "tls": "tls"

The multiple values are joined with commas in the order you picked them in the Host form. This happens in externalProxyALPN (internal/sub/service.go:2354-2362):

case []string:
	...
	return strings.Join(v, ","), true

That comma-separated form is the usual format for the alpn parameter in share links.

Your questions about V2RayN. I can only check this repository, not V2RayN's code, so the following is an inference that I could not confirm. In V2RayN the ALPN field in the node editor is a dropdown with a fixed list of combinations, written in the order h3, h2, http/1.1, for example h3,h2,http/1.1 or h2,http/1.1. If the imported value doesn't exactly match one of those entries, the dropdown can look empty even though the value was imported. Both of your values are in a different order (h2,http/1.1,h3 and http/1.1,h2,h3), so this would explain what you see. Two quick checks:

  1. Edit the Host so the ALPN values are selected in the order h3, then h2, then http/1.1, or use just h2,http/1.1. The link keeps the order you click them in. Refresh the subscription and open the node again.
  2. In V2RayN, right-click the node, choose Export share link to clipboard, and see whether alpn= is still there. If it is, V2RayN kept the value and only the editor fails to display it.

If the ALPN is really dropped on import, please report it to V2RayN (https://github.com/2dust/v2rayN/issues) and include the VLESS line you posted here.

I couldn't open your screenshot. Your text already gave me everything I needed.

Verdict:        Not a bug (expected behaviour)
Severity:       N/A
Confidence:     High
Root cause:     None in 3x-ui. The reporter's own raw subscription lines contain alpn with security=tls for VLESS, VMess and Trojan; the loss happens inside V2RayN 7.25.6.
Same class:     None found
Already fixed:  Not applicable
Duplicate of:   None
Evidence:       Reporter's raw links (alpn=h2%2Chttp%2F1.1%2Ch3 & security=tls; VMess "alpn":"h2,http/1.1,h3"); internal/sub/service.go:2354-2362 externalProxyALPN joins Host ALPN in selection order; frontend/src/pages/hosts/HostFormModal.tsx:416 multi-select with options from ALPN_OPTION (frontend/src/schemas/primitives/options.ts:16-20)
Not determined: Whether V2RayN discards the value or only fails to display a non-preset order; re-exporting the node's share link from V2RayN settles it.

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

<!-- gh-comment-id:6451188636 --> @github-actions[bot] commented on GitHub (Oct 27, 2026): The links you posted show that 3x-ui is producing correct output. Every one of them contains the Host's ALPN together with `security=tls` (or `"tls": "tls"` for VMess). So the panel is not losing the value. It is being lost when V2RayN imports the link or shows it in the editor, and only V2RayN can fix that. I'm closing this as not a 3x-ui defect. **What the panel sends.** Your three lines carry exactly what the subscription code is written to emit for a Host with Security `TLS`: - VLESS: `alpn=h2%2Chttp%2F1.1%2Ch3` and `security=tls` - Trojan: `alpn=http%2F1.1%2Ch2%2Ch3` and `security=tls` - VMess: `"alpn": "h2,http/1.1,h3"` and `"tls": "tls"` The multiple values are joined with commas in the order you picked them in the Host form. This happens in `externalProxyALPN` (`internal/sub/service.go:2354-2362`): ```go case []string: ... return strings.Join(v, ","), true ``` That comma-separated form is the usual format for the `alpn` parameter in share links. **Your questions about V2RayN.** I can only check this repository, not V2RayN's code, so the following is an **inference** that I could not confirm. In V2RayN the ALPN field in the node editor is a dropdown with a fixed list of combinations, written in the order `h3`, `h2`, `http/1.1`, for example `h3,h2,http/1.1` or `h2,http/1.1`. If the imported value doesn't exactly match one of those entries, the dropdown can look empty even though the value was imported. Both of your values are in a different order (`h2,http/1.1,h3` and `http/1.1,h2,h3`), so this would explain what you see. Two quick checks: 1. Edit the Host so the ALPN values are selected in the order `h3`, then `h2`, then `http/1.1`, or use just `h2,http/1.1`. The link keeps the order you click them in. Refresh the subscription and open the node again. 2. In V2RayN, right-click the node, choose **Export share link to clipboard**, and see whether `alpn=` is still there. If it is, V2RayN kept the value and only the editor fails to display it. If the ALPN is really dropped on import, please report it to V2RayN (https://github.com/2dust/v2rayN/issues) and include the VLESS line you posted here. I couldn't open your screenshot. Your text already gave me everything I needed. ``` Verdict: Not a bug (expected behaviour) Severity: N/A Confidence: High Root cause: None in 3x-ui. The reporter's own raw subscription lines contain alpn with security=tls for VLESS, VMess and Trojan; the loss happens inside V2RayN 7.25.6. Same class: None found Already fixed: Not applicable Duplicate of: None Evidence: Reporter's raw links (alpn=h2%2Chttp%2F1.1%2Ch3 & security=tls; VMess "alpn":"h2,http/1.1,h3"); internal/sub/service.go:2354-2362 externalProxyALPN joins Host ALPN in selection order; frontend/src/pages/hosts/HostFormModal.tsx:416 multi-select with options from ALPN_OPTION (frontend/src/schemas/primitives/options.ts:16-20) Not determined: Whether V2RayN discards the value or only fails to display a non-preset order; re-exporting the node's share link from V2RayN settles it. ``` *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#4604
No description provided.