mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #6982] Bug Report: ALPN settings defined in Hosts are not applied to V2RayN subscriptions #4604
Labels
No labels
backlog
bug
clarification needed
documentation
duplicate
enhancement
github_actions
good first issue
invalid
javascript
New Feature
PR welcomed
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MHSanaei/3x-ui#4604
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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
@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.
hostToExternalProxyMapcopies it onto the endpoint (internal/sub/host_sub.go:252-253):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):TestChar_C1_VlessExternalProxy(internal/sub/characterization_test.go:35-48) pins the working case: an endpoint withforceTls: tlsandalpn: ["h3","h2"]produces...?alpn=h3%2Ch2&...&security=tls....Case 1 (likely behind Nginx). If the inbound's Security is
nonebecause Nginx terminates TLS, and the Host's Security is left on "Same as inbound", the link is rendered withsecurity=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 carriessecurity=tlstogether with youralpn,sniandfp.Case 2 (Hysteria inbounds).
genHysteriaLinkdoes not use the shared TLS override path. It applies only the cert pin andinsecurefrom each Host (internal/sub/service.go:1638,applyExternalProxyHysteriaParams). Its comment atinternal/sub/service.go:2235-2237says 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:
none,tlsorreality), and the Host's Security value ("Same",TLSorNone).alpn=is missing from what the panel serves or whether V2RayN is not applying it.This reply was generated automatically; a maintainer may follow up.
@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:
I have separate inbounds using each of these transports:
2. Security configuration
none(TLS is disabled on the inbounds).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 inboundNginx 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, notSame as inbound, so the first scenario described in your response should not apply.Questions
I can provide the decoded subscription links with sensitive information redacted if needed.
Thank you.
@github-actions[bot] commented on GitHub (Oct 27, 2026):
Thanks, that rules out the "Same as inbound" case. With the inbound on
noneand the Host onTLS, 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
hostToExternalProxyMapstores yourTLSchoice asforceTls: "tls"(internal/sub/host_sub.go:230).buildEndpointLinksthen lets that override the inbound'snone(internal/sub/endpoint.go:127-133): WithsecurityToApply == "tls",applyExternalProxyTLSParamsadds the ALPN (internal/sub/service.go:2205-2217):params["alpn"] = alpn.genVlessLink) and Trojan (genTrojanLink) both use the URL-parameter path above.buildEndpointVmessLinks. It sets"tls"to the Host value and callsapplyExternalProxyTLSObj, which writesobj["alpn"](internal/sub/endpoint.go:165-179,internal/sub/service.go:2188-2189).none(internal/sub/service.go:2171, andomitTLSFieldsinappendQueryAndFragment).internal/sub/json_service.go:682-686) and setstlsSettings["alpn"](internal/sub/service.go:2300-2301).alpn=value (externalProxyALPN,internal/sub/service.go:2354).TestChar_C1_VlessExternalProxy(internal/sub/characterization_test.go:35) pinsalpn=h3%2Ch2together withsecurity=tls.The panel also sends
Cache-Control: no-cache, no-store, must-revalidateon 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:
curlor 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).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.This reply was generated automatically; a maintainer may follow up.
@sinath72 commented on GitHub (Oct 27, 2026):
Bug Report: Host ALPN is present in subscription links but missing in V2RayN node settings
Environment
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
TLS.h2,http/1.1, andh3.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
The ALPN parameter is present:
alpn=h2%2Chttp%2F1.1%2Ch3Decoded value:
h2,http/1.1,h32. VMess + WebSocket
The VMess subscription link contains a Base64-encoded JSON configuration. After decoding, the relevant fields are:
The UUID and address fields have been omitted or redacted where appropriate.
3. Trojan + WebSocket
The ALPN parameter is present:
alpn=http%2F1.1%2Ch2%2Ch3Decoded value:
http/1.1,h2,h3Questions
I can provide additional examples for HTTPUpgrade, XHTTP, and gRPC if needed.
Thank you.
@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:alpn=h2%2Chttp%2F1.1%2Ch3andsecurity=tlsalpn=http%2F1.1%2Ch2%2Ch3andsecurity=tls"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):That comma-separated form is the usual format for the
alpnparameter 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 exampleh3,h2,http/1.1orh2,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,h3andhttp/1.1,h2,h3), so this would explain what you see. Two quick checks:h3, thenh2, thenhttp/1.1, or use justh2,http/1.1. The link keeps the order you click them in. Refresh the subscription and open the node again.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.
This reply was generated automatically; a maintainer may follow up.