[GH-ISSUE #4933] [Bug]: ECH TLS configuration not included in final v2ray config #3453

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

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

Describe the bug

When adding an ECH (Encrypted Client Hello) TLS section in the inbound configuration, the generated configuration does not include or “ship” ECH parameters automatically in config.

How to reproduce the problem

  1. Add an inbound TLS configuration.
  2. Enable or add ECH-related settings in the TLS section.
  3. Generate or export the configuration.
  4. Observe that ECH settings are not present in the final shipped config.

Expected behavior

No response

Actual behavior

No response

Relevant logs


Screenshots

No response

3x-ui version

3.2.7

Xray-core version

26.6.1

How did you install 3x-ui?

install.sh script

Operating system

Ubunto 26.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?

Yes — Cloudflare (proxied DNS)

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 @JackieWelles17 on GitHub (Jun 4, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/4933 ### Describe the bug When adding an ECH (Encrypted Client Hello) TLS section in the inbound configuration, the generated configuration does not include or “ship” ECH parameters automatically in config. ### How to reproduce the problem 1. Add an inbound TLS configuration. 2. Enable or add ECH-related settings in the TLS section. 3. Generate or export the configuration. 4. Observe that ECH settings are not present in the final shipped config. ### Expected behavior _No response_ ### Actual behavior _No response_ ### Relevant logs ```shell ``` ### Screenshots _No response_ ### 3x-ui version 3.2.7 ### Xray-core version 26.6.1 ### How did you install 3x-ui? install.sh script ### Operating system Ubunto 26.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? Yes — Cloudflare (proxied DNS) ### 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:32:31 +07:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

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

Thanks for the report. After tracing the code I can confirm this is a real bug, and I've identified exactly where it happens.

Root cause

The inbound TLS form stores echConfigList under tlsSettings.settings.echConfigList (inside a client-settings sub-object called settings). But in web/service/xray.go (lines 225–233), when building the final Xray config for a process restart or startup, the code explicitly deletes the entire settings sub-object before writing the config:

// Remove the "settings" field under "tlsSettings" and "realitySettings"
tlsSettings, ok1 := stream["tlsSettings"].(map[string]any)
// ...
if ok1 {
    delete(tlsSettings, "settings")   // ← strips echConfigList too
}

This deletion is intentional for stripping client-facing sub-settings from the server config (fingerprint, pinnedPeerCertSha256, etc.), but it also wipes echConfigList because the frontend schema (TlsStreamSettingsSchema in frontend/src/schemas/protocols/security/tls.ts) placed it inside TlsClientSettingsSchema.settings rather than at the root level of tlsSettings.

As a result, the inbound config written to Xray looks like:

"tlsSettings": {
  "echServerKeys": "...",   // ✓ present — stored at root level
                             // ✗ echConfigList gone — was under settings, got deleted
}

Note: echServerKeys survives because it is stored at the root of tlsSettings, not inside settings.

Affected paths

Path Behaviour
Full config (Xray restart) settings deleted → echConfigList completely absent
Hot-add via API (runtime/local.go) settings not deleted, but echConfigList is still at settings.echConfigList rather than the root-level echConfigList Xray-core expects for server inbounds

Subscription link generation (sub/subService.go:603–612) intentionally reads from settings.echConfigList, so the ech= parameter in subscription links is unaffected by this bug. The problem is limited to the inbound config that Xray-core actually receives.

Suggested fix

The cleanest fix is in the backend Xray config builder (web/service/xray.go): before deleting tlsSettings["settings"], check whether it contains echConfigList and if so, hoist it to the root of tlsSettings:

if sub, ok := tlsSettings["settings"].(map[string]any); ok {
    if v, has := sub["echConfigList"]; has {
        if s, _ := v.(string); s \!= "" {
            tlsSettings["echConfigList"] = s
        }
    }
}
delete(tlsSettings, "settings")

An alternative is to restructure the frontend schema so echConfigList lives at the root of TlsStreamSettingsSchema instead of inside TlsClientSettingsSchema, but that requires a migration for existing stored configs and changes the subscription link reader in sub/subService.go as well.

Version note

The reporter is on v3.2.7 (current latest). The bug is present in the current source.

<!-- gh-comment-id:4626483292 --> @github-actions[bot] commented on GitHub (Jun 4, 2026): Thanks for the report. After tracing the code I can confirm this is a real bug, and I've identified exactly where it happens. ## Root cause The inbound TLS form stores `echConfigList` under `tlsSettings.settings.echConfigList` (inside a client-settings sub-object called `settings`). But in `web/service/xray.go` (lines 225–233), when building the final Xray config for a process restart or startup, the code **explicitly deletes the entire `settings` sub-object** before writing the config: ```go // Remove the "settings" field under "tlsSettings" and "realitySettings" tlsSettings, ok1 := stream["tlsSettings"].(map[string]any) // ... if ok1 { delete(tlsSettings, "settings") // ← strips echConfigList too } ``` This deletion is intentional for stripping client-facing sub-settings from the server config (fingerprint, pinnedPeerCertSha256, etc.), but it also wipes `echConfigList` because the frontend schema (`TlsStreamSettingsSchema` in `frontend/src/schemas/protocols/security/tls.ts`) placed it inside `TlsClientSettingsSchema.settings` rather than at the root level of `tlsSettings`. As a result, the inbound config written to Xray looks like: ```json "tlsSettings": { "echServerKeys": "...", // ✓ present — stored at root level // ✗ echConfigList gone — was under settings, got deleted } ``` Note: `echServerKeys` survives because it is stored at the root of `tlsSettings`, not inside `settings`. ## Affected paths | Path | Behaviour | |------|-----------| | Full config (Xray restart) | `settings` deleted → `echConfigList` completely absent | | Hot-add via API (`runtime/local.go`) | `settings` not deleted, but `echConfigList` is still at `settings.echConfigList` rather than the root-level `echConfigList` Xray-core expects for server inbounds | ## Subscription links Subscription link generation (`sub/subService.go:603–612`) intentionally reads from `settings.echConfigList`, so the `ech=` parameter in subscription links is **unaffected** by this bug. The problem is limited to the inbound config that Xray-core actually receives. ## Suggested fix The cleanest fix is in the backend Xray config builder (`web/service/xray.go`): before deleting `tlsSettings["settings"]`, check whether it contains `echConfigList` and if so, hoist it to the root of `tlsSettings`: ```go if sub, ok := tlsSettings["settings"].(map[string]any); ok { if v, has := sub["echConfigList"]; has { if s, _ := v.(string); s \!= "" { tlsSettings["echConfigList"] = s } } } delete(tlsSettings, "settings") ``` An alternative is to restructure the frontend schema so `echConfigList` lives at the root of `TlsStreamSettingsSchema` instead of inside `TlsClientSettingsSchema`, but that requires a migration for existing stored configs and changes the subscription link reader in `sub/subService.go` as well. ## Version note The reporter is on v3.2.7 (current latest). The bug is present in the current source.
Author
Owner

@MHSanaei commented on GitHub (Jun 4, 2026):

Fixed: ECH (echConfigList) is now included in VLESS/Trojan/VMess share links and the JSON subscription. The field is stored under tlsSettings.settings (panel-internal convention, stripped/flattened before reaching xray-core), but the subscription generators were only reading fingerprint and pinnedPeerCertSha256 from it and dropping ECH. Fixed in commit 79b105e8.

<!-- gh-comment-id:4626510964 --> @MHSanaei commented on GitHub (Jun 4, 2026): Fixed: ECH (echConfigList) is now included in VLESS/Trojan/VMess share links and the JSON subscription. The field is stored under tlsSettings.settings (panel-internal convention, stripped/flattened before reaching xray-core), but the subscription generators were only reading fingerprint and pinnedPeerCertSha256 from it and dropping ECH. Fixed in commit 79b105e8.
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#3453
No description provided.