[GH-ISSUE #5578] [Bug]: CDN Fake SNI broken after allowInsecure removal due to missing Certificate Path fields in "Edit Host" #3897

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

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

Describe the bug

With the upcoming removal of allowInsecure from the Xray core, configurations using CDN with a Fake SNI on port 443 will completely stop working.

To bypass censorship, we need to utilize both port 80 (HTTP) and port 443 (TLS) simultaneously via the Edit Host feature. We CANNOT simply set the main Inbound port to 443, because the main Inbound port must be set to a custom port (e.g., 1111) to match the backend port configured in the CDN (like Fastly).

Since the main Inbound is HTTP/Cleartext on port 1111, we use the Edit Host section to map client connections to ports 80 and 443. However, there is currently no way to provide an SSL certificate for the 443 host configuration inside the "Edit Host" menu. Previously, allowInsecure masked the lack of a real certificate on port 443, but now it causes an immediate handshake failure.

How to reproduce the problem

  1. Create a VLESS/VMess Inbound with a custom port (e.g., 1111) and leave TLS disabled (required for CDN/Fastly backend routing).

  2. Go to the Edit Host section of that Inbound.

  3. Add a host for port 80 (No TLS).

  4. Add another host for port 443, enable TLS, and set a Fake SNI (e.g., speedtest.net).

  5. Notice that there are no fields in the "Edit Host" menu to specify the actual SSL Certificate and Key paths (.crt / .key) for this 443 host.

  6. When allowInsecure is disabled, the connection fails immediately because the server has no certificate to present to the client on port 443.

Expected behavior

When TLS is enabled inside the Edit Host menu, there should be dedicated fields to specify the Certificate File Path and Key File Path for that specific host configuration.

This will allow the server to correctly present its real domain certificate on port 443 (while the main inbound remains on the custom port 1111), enabling the client to securely verify the connection via verifyPeerCertByName without depending on the deprecated allowInsecure option.

Actual behavior

The SSL Certificate/Key path fields are only available in the main Inbound settings. Since the main Inbound must stay on the custom port 1111 for CDN routing, there is no way to load a real SSL certificate for the 443 host configuration, making Fake SNI over CDN completely broken in newer Xray core versions.

Relevant logs


Screenshots

Image Image Image Image Image

3x-ui version

3.4.1

Xray-core version

v26.6.22

How did you install 3x-ui?

install.sh script

Operating system

ubuntu 22.04

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 @solidwar on GitHub (Jun 26, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5578 ### Describe the bug With the upcoming removal of allowInsecure from the Xray core, configurations using CDN with a Fake SNI on port 443 will completely stop working. To bypass censorship, we need to utilize both port 80 (HTTP) and port 443 (TLS) simultaneously via the Edit Host feature. We CANNOT simply set the main Inbound port to 443, because the main Inbound port must be set to a custom port (e.g., 1111) to match the backend port configured in the CDN (like Fastly). Since the main Inbound is HTTP/Cleartext on port 1111, we use the Edit Host section to map client connections to ports 80 and 443. However, there is currently no way to provide an SSL certificate for the 443 host configuration inside the "Edit Host" menu. Previously, allowInsecure masked the lack of a real certificate on port 443, but now it causes an immediate handshake failure. ### How to reproduce the problem 1. Create a VLESS/VMess Inbound with a custom port (e.g., 1111) and leave TLS disabled (required for CDN/Fastly backend routing). 2. Go to the Edit Host section of that Inbound. 3. Add a host for port 80 (No TLS). 4. Add another host for port 443, enable TLS, and set a Fake SNI (e.g., speedtest.net). 5. Notice that there are no fields in the "Edit Host" menu to specify the actual SSL Certificate and Key paths (.crt / .key) for this 443 host. 6. When allowInsecure is disabled, the connection fails immediately because the server has no certificate to present to the client on port 443. ### Expected behavior When TLS is enabled inside the Edit Host menu, there should be dedicated fields to specify the Certificate File Path and Key File Path for that specific host configuration. This will allow the server to correctly present its real domain certificate on port 443 (while the main inbound remains on the custom port 1111), enabling the client to securely verify the connection via verifyPeerCertByName without depending on the deprecated allowInsecure option. ### Actual behavior The SSL Certificate/Key path fields are only available in the main Inbound settings. Since the main Inbound must stay on the custom port 1111 for CDN routing, there is no way to load a real SSL certificate for the 443 host configuration, making Fake SNI over CDN completely broken in newer Xray core versions. ### Relevant logs ```shell ``` ### Screenshots <img width="533" height="387" alt="Image" src="https://github.com/user-attachments/assets/f6798b48-cf2c-4507-a19d-b7fd8f026f97" /> <img width="510" height="293" alt="Image" src="https://github.com/user-attachments/assets/de6711b7-74c8-402b-8cb4-42f05ecdc9e5" /> <img width="1080" height="526" alt="Image" src="https://github.com/user-attachments/assets/232dbd12-93d9-4849-93e3-17cd2177916c" /> <img width="849" height="74" alt="Image" src="https://github.com/user-attachments/assets/585536bc-90b6-4fa6-aedc-9760c8e7bbb1" /> <img width="374" height="370" alt="Image" src="https://github.com/user-attachments/assets/0167cb90-6129-4219-bd92-51436200feed" /> ### 3x-ui version 3.4.1 ### Xray-core version v26.6.22 ### How did you install 3x-ui? install.sh script ### Operating system ubuntu 22.04 ### 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:43 +07:00
Author
Owner

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

The feature request in this issue rests on a misunderstanding of what the Edit Host section does, which is why the certificate-path fields you are looking for do not exist there.

What Edit Host actually does

Edit Host entries are persisted in the Host table (internal/database/model/model.go) and converted to externalProxy entries by internal/sub/host_sub.go. These are entirely client-side parameters: they get embedded into subscription links and tell connecting clients which address, port, and TLS settings to use when dialling out. They never touch the Xray server's listener configuration.

certFile and keyFile are server-side inbound fields. They tell Xray what TLS certificate to load and present to incoming connections. They live on the inbound's tlsSettings.certificates[] array, not on client overrides. Adding them to an Edit Host entry would have no meaning in Xray's architecture — the host entry has no influence over what certificate the server presents.

The actual replacement for allowInsecure

The field you need already exists in the Edit Host form. It is called "Verify Peer Cert By Name" (verifyPeerCertByName), rendered at line 227 of frontend/src/pages/hosts/HostFormModal.tsx. Its tooltip in the English locale (internal/web/translation/en-US.json, line 617) reads:

Tell clients to verify the server certificate against this name instead of the SNI. Comma-separated names. Panel-only — included in share links (vcn). The modern replacement for allowInsecure, which Xray removed after 2026-06-01.

When set, this value is serialised into subscription links as the vcn parameter and injected into the client-side tlsSettings.settings.verifyPeerCertByName for JSON subscriptions (internal/sub/service.go, lines 1421–1427). It is the upstream replacement for allowInsecure.

How to fix your CDN/Fake SNI setup

In your scenario the CDN (Fastly) terminates TLS on port 443 and presents its own certificate to the client. allowInsecure was skipping verification of that certificate. To restore connectivity without allowInsecure:

  1. Determine the actual Common Name or SAN that the CDN's certificate is issued for. This is the name your client will receive during the TLS handshake — it could be your custom domain registered with Fastly, a wildcard Fastly SAN, or similar.
  2. In the Edit Host entry for port 443, leave the Fake SNI field set as before.
  3. In the Verify Peer Cert By Name field, enter the name(s) that appear in the CDN's certificate (comma-separated if multiple). The client will then verify the presented cert against those names instead of against the SNI.

This makes allowInsecure unnecessary for your use case. The allowInsecure toggle is still visible in the Edit Host form for compatibility, but Xray removed its client-side effect after 2026-06-01, so setting it no longer bypasses certificate errors on Xray v26.6.x and later.

If the CDN's certificate does not cover any predictable name (e.g. it serves an ephemeral shared cert), you can use pinnedPeerCertSha256 in the same Edit Host form to pin verification by certificate fingerprint instead.


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

<!-- gh-comment-id:4805885494 --> @github-actions[bot] commented on GitHub (Jun 26, 2026): The feature request in this issue rests on a misunderstanding of what the **Edit Host** section does, which is why the certificate-path fields you are looking for do not exist there. **What Edit Host actually does** Edit Host entries are persisted in the `Host` table (`internal/database/model/model.go`) and converted to `externalProxy` entries by `internal/sub/host_sub.go`. These are entirely **client-side parameters**: they get embedded into subscription links and tell connecting clients which address, port, and TLS settings to use when dialling out. They never touch the Xray server's listener configuration. `certFile` and `keyFile` are **server-side inbound fields**. They tell Xray what TLS certificate to load and present to incoming connections. They live on the inbound's `tlsSettings.certificates[]` array, not on client overrides. Adding them to an Edit Host entry would have no meaning in Xray's architecture — the host entry has no influence over what certificate the server presents. **The actual replacement for `allowInsecure`** The field you need already exists in the Edit Host form. It is called **"Verify Peer Cert By Name"** (`verifyPeerCertByName`), rendered at line 227 of `frontend/src/pages/hosts/HostFormModal.tsx`. Its tooltip in the English locale (`internal/web/translation/en-US.json`, line 617) reads: > Tell clients to verify the server certificate against this name instead of the SNI. Comma-separated names. Panel-only — included in share links (vcn). The modern replacement for allowInsecure, which Xray removed after 2026-06-01. When set, this value is serialised into subscription links as the `vcn` parameter and injected into the client-side `tlsSettings.settings.verifyPeerCertByName` for JSON subscriptions (`internal/sub/service.go`, lines 1421–1427). It is the upstream replacement for `allowInsecure`. **How to fix your CDN/Fake SNI setup** In your scenario the CDN (Fastly) terminates TLS on port 443 and presents its own certificate to the client. `allowInsecure` was skipping verification of that certificate. To restore connectivity without `allowInsecure`: 1. Determine the actual Common Name or SAN that the CDN's certificate is issued for. This is the name your client will receive during the TLS handshake — it could be your custom domain registered with Fastly, a wildcard Fastly SAN, or similar. 2. In the **Edit Host** entry for port 443, leave the **Fake SNI** field set as before. 3. In the **Verify Peer Cert By Name** field, enter the name(s) that appear in the CDN's certificate (comma-separated if multiple). The client will then verify the presented cert against those names instead of against the SNI. This makes `allowInsecure` unnecessary for your use case. The `allowInsecure` toggle is still visible in the Edit Host form for compatibility, but Xray removed its client-side effect after 2026-06-01, so setting it no longer bypasses certificate errors on Xray v26.6.x and later. If the CDN's certificate does not cover any predictable name (e.g. it serves an ephemeral shared cert), you can use `pinnedPeerCertSha256` in the same Edit Host form to pin verification by certificate fingerprint instead. --- *This reply was generated automatically; a maintainer may follow up.*
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#3897
No description provided.