[GH-ISSUE #6839] [Feature]: Support dynamic DoH format in echConfigList and explain/warn about CDN incompatibility for local generated keys #4551

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

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

When configuring Inbound TLS with ECH enabled in 3X-UI, the panel currently provides a button to automatically generate a local ECH keypair (storing the private key in Xray config and outputting the base64 public key to echConfigList).

However, for users proxying traffic through Cloudflare CDN (e.g., using VLESS + xhttp / WebSocket with orange-cloud enabled):

  1. Locally generated static keys do not work: Cloudflare terminates the outer TLS handshake using its own ECH private keys. Handshakes fail when clients use the panel-generated local ECH public key.
  2. Key rotation breaks connections: Cloudflare periodically rotates its public ECH keys, rendering hardcoded base64 strings invalid after a short period.
  3. No Dynamic DoH format option: Clients running modern Xray-core / Sing-box support dynamically resolving the ECH config via DoH, but the panel cannot easily generate or export this syntax.

Describe the solution you'd like

  1. Support Dynamic DoH Resolver Format in echConfigList:

    • Allow entering and exporting the dynamic DoH syntax in the format:
      <Target_Domain>+<DoH_URL>
      (e.g., cloudflare-ech.com+https://dns.alidns.com/dns-query or cloudflare-ech.com+https://1.1.1.1/dns-query).
    • Ensure the UI validator does not reject strings containing + and URLs in echConfigList.
  2. Add a Preset / Helper for Cloudflare Users:

    • In the ECH configuration section, provide a toggle or preset option such as "Use Cloudflare Dynamic ECH".
    • When selected, automatically populate the client export / subscription with the standard Cloudflare ECH domain and popular DoH endpoints (e.g., AliDNS / Cloudflare DoH).
  3. UI Tooltip / Clarification:

    • Add a brief hint near the "Generate ECH Key" button clarifying that locally generated keys are only valid for direct VPS connections, and will NOT work when proxied behind Cloudflare CDN.

Describe alternatives you've considered

Currently, users have to manually edit every exported link or client config profile (e.g. in v2rayN or mobile apps) to replace the panel-generated base64 string with cloudflare-ech.com+https://dns.alidns.com/dns-query. This causes significant friction and breaks standard subscription update flows.

Additional context

With Cloudflare xhttp becoming a dominant transport protocol to mitigate active probing and SNI blocking, having seamless dynamic ECH support out of the box will significantly improve usability for users utilizing CDN networks.

Describe the solution you'd like

Describe the solution you'd like

We propose a multi-level improvement covering UI validation, dynamic presets, and link export logic:

  1. Relax Input Validation on echConfigList:

    • Modify the frontend regex/schema validator to allow dynamic resolver strings formatted as <Domain>+<DoH_URL> (allowing characters like +, :, /, and query strings ?), instead of strictly enforcing standard Base64 encoding.
  2. Add a "Cloudflare Dynamic ECH" Preset / Toggle:

    • In the Inbound TLS settings (next to ECH), add a toggle: "Mode: Local Static Key / Cloudflare Dynamic DoH".
    • When switching to "Cloudflare Dynamic DoH":
      • Hide/disable the server-side private key generation (since the VPS doesn't terminate the outer TLS handshake when proxied through Cloudflare).
      • Provide quick dropdown presets for commonly used DoH endpoints:
        • cloudflare-ech.com+https://dns.alidns.com/dns-query (AliDNS)
        • cloudflare-ech.com+https://sm2.doh.pub/dns-query (DNSPod / Tencent)
        • cloudflare-ech.com+https://cloudflare-dns.com/dns-query (Cloudflare)
        • Custom input option.
  3. Export & Subscription Link Support:

    • Ensure the generated VLESS / Trojan / VMess share links properly encode and include the dynamic echConfigList string in the URL parameters (e.g., &echConfigList=cloudflare-ech.com%2Bhttps%3A%2F%2Fdns.alidns.com%2Fdns-query or plaintext + where compliant), allowing clients like v2rayN, Sing-box, and mobile apps to directly ingest it without manual intervention.
  4. UI Guidance & Tooltips:

    • Display an inline info banner:

      "Notice: The local 'Generate Key' button creates an ECH keypair valid ONLY for direct VPS IP connections. If your inbound is proxied behind Cloudflare (CDN / xhttp / WS), use the Dynamic DoH mode instead to prevent handshake failures caused by key rotation."

Alternatives you've considered

No response

Concrete use case

No response

Mockups, screenshots, or examples

Key Value & Real-world Use Case: Complete SNI + Origin IP Masking

By combining Cloudflare CDN with dynamic DoH ECH, users achieve full-path obfuscation against DPI and censorship:

  1. Unblocking Banned/Censored Domains:
    Default subdomains like *.pages.dev or *.workers.dev are heavily blocked by SNI-based RST/resets in strict network environments. With ECH enabled, the real SNI (Inner SNI) is fully encrypted inside the TLS handshake. The middlebox only observes the harmless outer SNI (cloudflare-ech.com), effectively bypassing SNI filtering and reviving otherwise blocked domains without needing clean custom domains.

  2. Dual-Layer Hiding (IP + SNI):

    • Origin IP Hidden: Connecting via Cloudflare Anycast/Clean IPs (e.g., 104.17.17.181) hides the VPS server's true IP.
    • Target Domain Hidden: Dynamic ECH hides the actual service domain/SNI from DPI inspection.
    • To outside censors, the connection appears purely as a standard HTTPS handshake to Cloudflare's public infrastructure.
  3. Maintenance-Free Connection:
    Because Cloudflare regularly rotates its public ECH keys, standard static Base64 keys break within days. Supporting the dynamic syntax (domain+doh) ensures the connection stays alive long-term without requiring users to constantly re-extract and replace keys manually.

Which parts of the panel would this affect?

No response

Are you willing to help?

  • I'd like to implement this feature myself and open a PR.
  • I can help test once a PR is open.

Before submitting

  • I searched existing issues and this feature has not been requested.
  • This feature request is written in English.
Originally created by @55575455 on GitHub (Oct 15, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6839 ### Is your feature request related to a problem? When configuring Inbound TLS with ECH enabled in 3X-UI, the panel currently provides a button to automatically generate a local ECH keypair (storing the private key in Xray config and outputting the base64 public key to `echConfigList`). However, for users proxying traffic through Cloudflare CDN (e.g., using VLESS + xhttp / WebSocket with orange-cloud enabled): 1. **Locally generated static keys do not work:** Cloudflare terminates the outer TLS handshake using its own ECH private keys. Handshakes fail when clients use the panel-generated local ECH public key. 2. **Key rotation breaks connections:** Cloudflare periodically rotates its public ECH keys, rendering hardcoded base64 strings invalid after a short period. 3. **No Dynamic DoH format option:** Clients running modern Xray-core / Sing-box support dynamically resolving the ECH config via DoH, but the panel cannot easily generate or export this syntax. ### Describe the solution you'd like 1. **Support Dynamic DoH Resolver Format in `echConfigList`:** - Allow entering and exporting the dynamic DoH syntax in the format: `<Target_Domain>+<DoH_URL>` (e.g., `cloudflare-ech.com+https://dns.alidns.com/dns-query` or `cloudflare-ech.com+https://1.1.1.1/dns-query`). - Ensure the UI validator does not reject strings containing `+` and URLs in `echConfigList`. 2. **Add a Preset / Helper for Cloudflare Users:** - In the ECH configuration section, provide a toggle or preset option such as **"Use Cloudflare Dynamic ECH"**. - When selected, automatically populate the client export / subscription with the standard Cloudflare ECH domain and popular DoH endpoints (e.g., AliDNS / Cloudflare DoH). 3. **UI Tooltip / Clarification:** - Add a brief hint near the "Generate ECH Key" button clarifying that locally generated keys are only valid for **direct VPS connections**, and will NOT work when proxied behind Cloudflare CDN. ### Describe alternatives you've considered Currently, users have to manually edit every exported link or client config profile (e.g. in v2rayN or mobile apps) to replace the panel-generated base64 string with `cloudflare-ech.com+https://dns.alidns.com/dns-query`. This causes significant friction and breaks standard subscription update flows. ### Additional context With Cloudflare xhttp becoming a dominant transport protocol to mitigate active probing and SNI blocking, having seamless dynamic ECH support out of the box will significantly improve usability for users utilizing CDN networks. ### Describe the solution you'd like ### Describe the solution you'd like We propose a multi-level improvement covering UI validation, dynamic presets, and link export logic: 1. **Relax Input Validation on `echConfigList`:** - Modify the frontend regex/schema validator to allow dynamic resolver strings formatted as `<Domain>+<DoH_URL>` (allowing characters like `+`, `:`, `/`, and query strings `?`), instead of strictly enforcing standard Base64 encoding. 2. **Add a "Cloudflare Dynamic ECH" Preset / Toggle:** - In the Inbound TLS settings (next to ECH), add a toggle: **"Mode: Local Static Key / Cloudflare Dynamic DoH"**. - When switching to "Cloudflare Dynamic DoH": - Hide/disable the server-side private key generation (since the VPS doesn't terminate the outer TLS handshake when proxied through Cloudflare). - Provide quick dropdown presets for commonly used DoH endpoints: - `cloudflare-ech.com+https://dns.alidns.com/dns-query` (AliDNS) - `cloudflare-ech.com+https://sm2.doh.pub/dns-query` (DNSPod / Tencent) - `cloudflare-ech.com+https://cloudflare-dns.com/dns-query` (Cloudflare) - Custom input option. 3. **Export & Subscription Link Support:** - Ensure the generated VLESS / Trojan / VMess share links properly encode and include the dynamic `echConfigList` string in the URL parameters (e.g., `&echConfigList=cloudflare-ech.com%2Bhttps%3A%2F%2Fdns.alidns.com%2Fdns-query` or plaintext `+` where compliant), allowing clients like v2rayN, Sing-box, and mobile apps to directly ingest it without manual intervention. 4. **UI Guidance & Tooltips:** - Display an inline info banner: > *"Notice: The local 'Generate Key' button creates an ECH keypair valid ONLY for direct VPS IP connections. If your inbound is proxied behind Cloudflare (CDN / xhttp / WS), use the Dynamic DoH mode instead to prevent handshake failures caused by key rotation."* ### Alternatives you've considered _No response_ ### Concrete use case _No response_ ### Mockups, screenshots, or examples ### Key Value & Real-world Use Case: Complete SNI + Origin IP Masking By combining Cloudflare CDN with dynamic DoH ECH, users achieve full-path obfuscation against DPI and censorship: 1. **Unblocking Banned/Censored Domains:** Default subdomains like `*.pages.dev` or `*.workers.dev` are heavily blocked by SNI-based RST/resets in strict network environments. With ECH enabled, the real SNI (`Inner SNI`) is fully encrypted inside the TLS handshake. The middlebox only observes the harmless outer SNI (`cloudflare-ech.com`), effectively bypassing SNI filtering and reviving otherwise blocked domains without needing clean custom domains. 2. **Dual-Layer Hiding (IP + SNI):** - **Origin IP Hidden:** Connecting via Cloudflare Anycast/Clean IPs (e.g., `104.17.17.181`) hides the VPS server's true IP. - **Target Domain Hidden:** Dynamic ECH hides the actual service domain/SNI from DPI inspection. - To outside censors, the connection appears purely as a standard HTTPS handshake to Cloudflare's public infrastructure. 3. **Maintenance-Free Connection:** Because Cloudflare regularly rotates its public ECH keys, standard static Base64 keys break within days. Supporting the dynamic syntax (`domain+doh`) ensures the connection stays alive long-term without requiring users to constantly re-extract and replace keys manually. ### Which parts of the panel would this affect? _No response_ ### Are you willing to help? - [ ] I'd like to implement this feature myself and open a PR. - [x] I can help test once a PR is open. ### Before submitting - [x] I searched [existing issues](../issues?q=is%3Aissue) and this feature has not been requested. - [x] This feature request is written in English.
bsakaguchi 2026-10-31 20:40:26 +07:00
Author
Owner

@55575455 commented on GitHub (Oct 15, 2026):

Real-world Case: Reviving Blocked Custom Domains & True Zero-Knowledge Transport

To illustrate why this feature is critical, here is a practical scenario from actual deployment on a self-owned VPS (not limited to pages.dev):

1. Reviving Blocked / Dirty Custom Domains

Many low-cost domains (such as cheap numeric .xyz domains) are already blocked by SNI filtering right upon purchase, or get blocked shortly after.

  • Normally, once a custom domain is blacklisted by DPI/firewalls, proxy traffic routing through it is completely severed.
  • With Dynamic ECH enabled behind Cloudflare CDN, the blocked custom domain is encrypted as the Inner SNI. Censors only observe the harmless, shared Outer SNI (cloudflare-ech.com).
  • Result: Even domains that are completely blacklisted locally can be fully revived and used stably without purchasing new domains.

2. Three-Layer Privacy & Obfuscation (IP + SNI + Payload)

Combining Cloudflare CDN + Dynamic ECH + VLESS Encryption establishes a complete zero-knowledge security chain:

  1. Hide Origin IP: Cloudflare Anycast / Clean IPs completely shield the user's actual VPS IP from censors.
  2. Hide Domain / SNI: Dynamic ECH encrypts the real domain inside TLS, preventing firewalls and DPI from identifying the domain or analyzing intent.
  3. Hide Payload from CDN (Zero-Trust CDN): By pairing this with VLESS inner encryption, the payload remains end-to-end encrypted before entering Cloudflare. The CDN operates purely as an encrypted dumb pipe—not even Cloudflare can inspect what actual websites, services, or protocols the user is accessing.

Summary

This workflow isn't just a workaround for Pages—it is an essential, highly cost-effective survival architecture for users deploying custom domains and self-hosted VPS servers in heavily censored network regions. Providing seamless Dynamic DoH input and export in 3X-UI will make this setup accessible to everyone without tedious manual config hacking.

<!-- gh-comment-id:6191446586 --> @55575455 commented on GitHub (Oct 15, 2026): ### Real-world Case: Reviving Blocked Custom Domains & True Zero-Knowledge Transport To illustrate why this feature is critical, here is a practical scenario from actual deployment on a **self-owned VPS (not limited to pages.dev)**: #### 1. Reviving Blocked / Dirty Custom Domains Many low-cost domains (such as cheap numeric `.xyz` domains) are already blocked by SNI filtering right upon purchase, or get blocked shortly after. - Normally, once a custom domain is blacklisted by DPI/firewalls, proxy traffic routing through it is completely severed. - **With Dynamic ECH enabled behind Cloudflare CDN**, the blocked custom domain is encrypted as the `Inner SNI`. Censors only observe the harmless, shared `Outer SNI` (`cloudflare-ech.com`). - **Result:** Even domains that are completely blacklisted locally can be fully revived and used stably without purchasing new domains. #### 2. Three-Layer Privacy & Obfuscation (IP + SNI + Payload) Combining **Cloudflare CDN + Dynamic ECH + VLESS Encryption** establishes a complete zero-knowledge security chain: 1. **Hide Origin IP:** Cloudflare Anycast / Clean IPs completely shield the user's actual VPS IP from censors. 2. **Hide Domain / SNI:** Dynamic ECH encrypts the real domain inside TLS, preventing firewalls and DPI from identifying the domain or analyzing intent. 3. **Hide Payload from CDN (Zero-Trust CDN):** By pairing this with VLESS inner encryption, the payload remains end-to-end encrypted before entering Cloudflare. The CDN operates purely as an encrypted dumb pipe—**not even Cloudflare can inspect what actual websites, services, or protocols the user is accessing**. #### Summary This workflow isn't just a workaround for Pages—it is an essential, highly cost-effective survival architecture for users deploying custom domains and self-hosted VPS servers in heavily censored network regions. Providing seamless Dynamic DoH input and export in 3X-UI will make this setup accessible to everyone without tedious manual config hacking.
Author
Owner

@55575455 commented on GitHub (Oct 15, 2026):

Image
<!-- gh-comment-id:6191491100 --> @55575455 commented on GitHub (Oct 15, 2026): <img width="1280" height="764" alt="Image" src="https://github.com/user-attachments/assets/dd9657b6-1cf7-46d6-ba8f-d077692a2a41" />
Author
Owner

@MHSanaei commented on GitHub (Oct 16, 2026):

@claude analyze

<!-- gh-comment-id:6212790542 --> @MHSanaei commented on GitHub (Oct 16, 2026): @claude analyze
Author
Owner

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

Most of this already works on the current default branch. The panel does not validate the ECH field, so it accepts the <domain>+<DoH URL> form, and every link and subscription builder passes the value to clients unchanged. Two things are missing: a "Cloudflare dynamic ECH" preset and a hint that the generated key is for direct connections only. Those are the actual feature request here.

This is the first analysis on this thread. I could not open the screenshot in the last comment. If it shows an error, please paste the text.

What already works

  1. No validator rejects +, : or /. The inbound TLS form's ECH config field is a plain <Input /> with no rules (frontend/src/pages/inbounds/form/security/tls.tsx:361-366), and its schema is just echConfigList: z.string().default('') (frontend/src/schemas/protocols/security/tls.ts:85). The Go side has no check on it either.
  2. Share links and subscriptions carry it as written. For the inbound's own TLS settings:
    if echValue, ok := searchKey(tlsSettings, "echConfigList"); ok {
        if ech, _ := echValue.(string); ech != "" {
            params["ech"] = ech
    
    (internal/sub/service.go:1452-1455). Query strings are built with url.Values (internal/sub/service.go:2335), so + becomes %2B and the client decodes it back. The JSON subscription writes it to tlsSettings.echConfigList (internal/sub/json_service.go:807-808). The in-panel links do the same with params.set('ech', …) in frontend/src/lib/xray/inbound-link.ts:474,578,819.
  3. The DoH form is already covered by a test. TestSub_HostTLSVerificationJSONAtXrayLevel (internal/sub/host_sub_test.go:624) stores EchConfigList: "cloudflare-ech.com+udp://1.1.1.1" on a Host and checks that the JSON subscription emits exactly that string.

How to set up the Cloudflare CDN case today

Use a Host for the CDN endpoint. Hosts have their own ECH config list field (frontend/src/pages/hosts/HostFormModal.tsx:361-366), which replaces the inbound's value for that one link (internal/sub/service.go:2095-2096, 2168-2174):

  1. Open Hosts and add a Host for the inbound. Set the address to your Cloudflare domain or clean IP and Security to tls.
  2. Put the DoH form in ECH config list, for example:
    cloudflare-ech.com+https://dns.alidns.com/dns-query
    
  3. If the inbound only ever runs behind Cloudflare, you can instead put the same string in the inbound's ECH config field and leave ECH key empty. Cloudflare terminates the outer TLS, so Xray never uses a local key in that topology.

That way direct links and CDN links each get the ECH value that fits them. Nothing needs editing on the client side, and a subscription refresh keeps the value.

What is not there

  • A preset or toggle such as "Local key / Cloudflare dynamic DoH" with a list of DoH endpoints. Nothing like this exists. The only ECH helper is Get New ECH Cert (useSecurityActions.ts:190-198), which fills both the key and the config list from a locally generated keypair.
  • A hint near that button. The ECH fields have no tooltip. The labels are just "echKey": "ECH key" and "echConfig": "ECH config" (internal/web/translation/en-US.json:613-614). A tooltip there would be a small, self-contained change.

#4934 asked the panel to fetch Cloudflare's ECH config automatically. It was closed as out of scope because that would tie the panel to a Cloudflare API or DNS lookup. This request is different: the domain+DoH string is static, and the client resolves it. Whether to add a preset is the maintainer's call.

Verdict: Feature request. Input and export of the DoH form already work. The open parts are the preset/toggle and the guidance tooltip.

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

<!-- gh-comment-id:6212819370 --> @github-actions[bot] commented on GitHub (Oct 16, 2026): Most of this already works on the current default branch. The panel does not validate the ECH field, so it accepts the `<domain>+<DoH URL>` form, and every link and subscription builder passes the value to clients unchanged. Two things are missing: a "Cloudflare dynamic ECH" preset and a hint that the generated key is for direct connections only. Those are the actual feature request here. This is the first analysis on this thread. I could not open the screenshot in the last comment. If it shows an error, please paste the text. ### What already works 1. **No validator rejects `+`, `:` or `/`.** The inbound TLS form's ECH config field is a plain `<Input />` with no `rules` (`frontend/src/pages/inbounds/form/security/tls.tsx:361-366`), and its schema is just `echConfigList: z.string().default('')` (`frontend/src/schemas/protocols/security/tls.ts:85`). The Go side has no check on it either. 2. **Share links and subscriptions carry it as written.** For the inbound's own TLS settings: ```go if echValue, ok := searchKey(tlsSettings, "echConfigList"); ok { if ech, _ := echValue.(string); ech != "" { params["ech"] = ech ``` (`internal/sub/service.go:1452-1455`). Query strings are built with `url.Values` (`internal/sub/service.go:2335`), so `+` becomes `%2B` and the client decodes it back. The JSON subscription writes it to `tlsSettings.echConfigList` (`internal/sub/json_service.go:807-808`). The in-panel links do the same with `params.set('ech', …)` in `frontend/src/lib/xray/inbound-link.ts:474,578,819`. 3. **The DoH form is already covered by a test.** `TestSub_HostTLSVerificationJSONAtXrayLevel` (`internal/sub/host_sub_test.go:624`) stores `EchConfigList: "cloudflare-ech.com+udp://1.1.1.1"` on a Host and checks that the JSON subscription emits exactly that string. ### How to set up the Cloudflare CDN case today Use a **Host** for the CDN endpoint. Hosts have their own **ECH config list** field (`frontend/src/pages/hosts/HostFormModal.tsx:361-366`), which replaces the inbound's value for that one link (`internal/sub/service.go:2095-2096`, `2168-2174`): 1. Open **Hosts** and add a Host for the inbound. Set the address to your Cloudflare domain or clean IP and **Security** to `tls`. 2. Put the DoH form in **ECH config list**, for example: ``` cloudflare-ech.com+https://dns.alidns.com/dns-query ``` 3. If the inbound only ever runs behind Cloudflare, you can instead put the same string in the inbound's **ECH config** field and leave **ECH key** empty. Cloudflare terminates the outer TLS, so Xray never uses a local key in that topology. That way direct links and CDN links each get the ECH value that fits them. Nothing needs editing on the client side, and a subscription refresh keeps the value. ### What is not there - **A preset or toggle** such as "Local key / Cloudflare dynamic DoH" with a list of DoH endpoints. Nothing like this exists. The only ECH helper is **Get New ECH Cert** (`useSecurityActions.ts:190-198`), which fills both the key and the config list from a locally generated keypair. - **A hint near that button.** The ECH fields have no tooltip. The labels are just `"echKey": "ECH key"` and `"echConfig": "ECH config"` (`internal/web/translation/en-US.json:613-614`). A tooltip there would be a small, self-contained change. ### Related #4934 asked the panel to fetch Cloudflare's ECH config automatically. It was closed as out of scope because that would tie the panel to a Cloudflare API or DNS lookup. This request is different: the `domain+DoH` string is static, and the client resolves it. Whether to add a preset is the maintainer's call. Verdict: Feature request. Input and export of the DoH form already work. The open parts are the preset/toggle and the guidance tooltip. *This reply was generated automatically; a maintainer may follow up.* <!-- claude-issue:analyst -->
Author
Owner

@55575455 commented on GitHub (Oct 17, 2026):

Clarification and Proposed Implementation

After reviewing the existing implementation, I would like to clarify the main goal of this feature request.

The issue is not simply whether Xray can support Dynamic ECH. The underlying echConfigList field already accepts and exports the dynamic format:

<domain>+<DoH_URL>

For example:

cloudflare-ech.com+https://dns.alidns.com/dns-query

The missing piece is that Dynamic ECH is not exposed as a first-class, selectable configuration mode in the 3x-ui UI. Users currently need to know the Xray-specific syntax and manually enter it into echConfigList. I believe this functionality should be easier to discover, configure, and use.

1. Distinguish local ECH from CDN ECH

There are two fundamentally different deployment scenarios.

Direct connection to an Xray server:

Client → VPS / Xray

Here, Xray terminates the TLS connection. Generating a local ECH keypair is appropriate because Xray controls the TLS endpoint.

Connection through Cloudflare CDN:

Client → Cloudflare → VPS / Xray

In this case, Cloudflare terminates the client-facing TLS connection. The ECH configuration generated locally by Xray is not the ECH configuration published by Cloudflare for that connection.

Instead, the client needs Cloudflare's published ECH configuration, which can be retrieved dynamically through DNS-over-HTTPS (DoH).

For example:

cloudflare-ech.com+https://dns.alidns.com/dns-query

This distinction is not sufficiently clear when the UI presents local ECH key generation as the primary configuration workflow. Users may configure Cloudflare CDN, generate a local ECH keypair, and mistakenly assume that the resulting configuration is suitable for the CDN-facing TLS connection.

2. Expose Dynamic ECH as a selectable mode

I propose adding a clear mode selector to the ECH configuration interface, for example:

ECH Mode:

○ Disabled
○ Local ECH (Generate Keypair)
○ Dynamic ECH (DNS-over-HTTPS)

When Dynamic ECH is selected, the UI could expose the following fields:

ECH Domain: cloudflare-ech.com

DoH Resolver:
https://dns.alidns.com/dns-query

The values above are examples. The panel should preserve the existing ability to configure the underlying echConfigList directly, where appropriate, so that advanced users are not restricted to predefined settings.

The distinction is important:

Backend compatibility with Dynamic ECH does not mean Dynamic ECH is available as a user-selectable feature in the panel.

My request is primarily about making the existing capability accessible through a proper UI workflow, rather than reimplementing functionality that Xray already supports.

3. Make the DoH resolver configurable

The reason I chose AliDNS in the example is practical.

For users connecting from mainland China, many commonly used overseas DoH resolvers may be blocked, unreliable, or otherwise inaccessible due to network restrictions and interference. Consequently, a Dynamic ECH configuration can fail to retrieve the required DNS information even when the Xray implementation itself supports Dynamic ECH.

A configurable DoH endpoint would allow users to select a resolver that is reachable and reliable in their own network environment.

AliDNS is only an example, not a requirement. Users in other regions should be able to use other compatible resolvers.

The ECH domain and the DoH resolver serve different purposes:

  • ECH domain: Identifies the domain whose published ECH configuration needs to be retrieved.
  • DoH resolver: Specifies the DNS-over-HTTPS endpoint used to retrieve that information.

I would therefore prefer a configurable resolver field instead of hardcoding a single DoH provider. This would also avoid unnecessarily coupling the implementation to a specific DNS service.

4. Keep the implementation simple

I do not think this feature necessarily requires Cloudflare API integration or a separate key-management system in 3x-ui.

If the existing Xray configuration, subscription-generation, and sharing-link mechanisms already support the dynamic domain+DoH_URL format, they can remain unchanged.

The main improvements would be:

  • Add Dynamic ECH as an explicit UI option.
  • Allow users to configure the ECH domain and DoH resolver.
  • Clearly distinguish locally generated ECH keys from dynamically retrieved CDN ECH configurations.
  • Ensure the selected configuration is correctly preserved when generating client subscriptions and sharing links.

This would make Dynamic ECH a properly supported user-facing feature without duplicating functionality already provided by Xray.

Summary

My main request is to make Dynamic ECH a first-class option in 3x-ui, with a configurable DoH resolver and clear guidance on when to use local ECH versus CDN ECH.

The existing backend may already support the necessary configuration format, but users should not have to discover an undocumented syntax and manually enter it to use a feature that is particularly relevant to CDN-based deployments.

I believe this would be a relatively small UI improvement with a meaningful impact on usability, especially for users whose network environments require a specific DoH resolver.

<!-- gh-comment-id:6232057786 --> @55575455 commented on GitHub (Oct 17, 2026): ### Clarification and Proposed Implementation After reviewing the existing implementation, I would like to clarify the main goal of this feature request. The issue is not simply whether Xray can support Dynamic ECH. The underlying `echConfigList` field already accepts and exports the dynamic format: ```text <domain>+<DoH_URL> ``` For example: ```text cloudflare-ech.com+https://dns.alidns.com/dns-query ``` **The missing piece is that Dynamic ECH is not exposed as a first-class, selectable configuration mode in the 3x-ui UI.** Users currently need to know the Xray-specific syntax and manually enter it into `echConfigList`. I believe this functionality should be easier to discover, configure, and use. #### 1. Distinguish local ECH from CDN ECH There are two fundamentally different deployment scenarios. **Direct connection to an Xray server:** ```text Client → VPS / Xray ``` Here, Xray terminates the TLS connection. Generating a local ECH keypair is appropriate because Xray controls the TLS endpoint. **Connection through Cloudflare CDN:** ```text Client → Cloudflare → VPS / Xray ``` In this case, Cloudflare terminates the client-facing TLS connection. The ECH configuration generated locally by Xray is not the ECH configuration published by Cloudflare for that connection. Instead, the client needs Cloudflare's published ECH configuration, which can be retrieved dynamically through DNS-over-HTTPS (DoH). For example: ```text cloudflare-ech.com+https://dns.alidns.com/dns-query ``` This distinction is not sufficiently clear when the UI presents local ECH key generation as the primary configuration workflow. Users may configure Cloudflare CDN, generate a local ECH keypair, and mistakenly assume that the resulting configuration is suitable for the CDN-facing TLS connection. #### 2. Expose Dynamic ECH as a selectable mode I propose adding a clear mode selector to the ECH configuration interface, for example: ```text ECH Mode: ○ Disabled ○ Local ECH (Generate Keypair) ○ Dynamic ECH (DNS-over-HTTPS) ``` When Dynamic ECH is selected, the UI could expose the following fields: ```text ECH Domain: cloudflare-ech.com DoH Resolver: https://dns.alidns.com/dns-query ``` The values above are examples. The panel should preserve the existing ability to configure the underlying `echConfigList` directly, where appropriate, so that advanced users are not restricted to predefined settings. The distinction is important: **Backend compatibility with Dynamic ECH does not mean Dynamic ECH is available as a user-selectable feature in the panel.** My request is primarily about making the existing capability accessible through a proper UI workflow, rather than reimplementing functionality that Xray already supports. #### 3. Make the DoH resolver configurable The reason I chose AliDNS in the example is practical. For users connecting from mainland China, many commonly used overseas DoH resolvers may be blocked, unreliable, or otherwise inaccessible due to network restrictions and interference. Consequently, a Dynamic ECH configuration can fail to retrieve the required DNS information even when the Xray implementation itself supports Dynamic ECH. A configurable DoH endpoint would allow users to select a resolver that is reachable and reliable in their own network environment. AliDNS is only an example, not a requirement. Users in other regions should be able to use other compatible resolvers. The ECH domain and the DoH resolver serve different purposes: - **ECH domain:** Identifies the domain whose published ECH configuration needs to be retrieved. - **DoH resolver:** Specifies the DNS-over-HTTPS endpoint used to retrieve that information. I would therefore prefer a configurable resolver field instead of hardcoding a single DoH provider. This would also avoid unnecessarily coupling the implementation to a specific DNS service. #### 4. Keep the implementation simple I do not think this feature necessarily requires Cloudflare API integration or a separate key-management system in 3x-ui. If the existing Xray configuration, subscription-generation, and sharing-link mechanisms already support the dynamic `domain+DoH_URL` format, they can remain unchanged. The main improvements would be: - Add Dynamic ECH as an explicit UI option. - Allow users to configure the ECH domain and DoH resolver. - Clearly distinguish locally generated ECH keys from dynamically retrieved CDN ECH configurations. - Ensure the selected configuration is correctly preserved when generating client subscriptions and sharing links. This would make Dynamic ECH a properly supported user-facing feature without duplicating functionality already provided by Xray. ### Summary My main request is to make Dynamic ECH a first-class option in 3x-ui, with a configurable DoH resolver and clear guidance on when to use local ECH versus CDN ECH. The existing backend may already support the necessary configuration format, but users should not have to discover an undocumented syntax and manually enter it to use a feature that is particularly relevant to CDN-based deployments. I believe this would be a relatively small UI improvement with a meaningful impact on usability, especially for users whose network environments require a specific DoH resolver.
Author
Owner

@55575455 commented on GitHub (Oct 17, 2026):

Clarification

Thanks for the analysis. I think the current implementation confirms what I was trying to address.

I agree that the underlying Xray configuration and subscription/export mechanisms already support the Dynamic ECH format:

<domain>+<DoH_URL>

For example:

cloudflare-ech.com+https://dns.alidns.com/dns-query

So I don't think this requires a major backend implementation.

The main thing I would like to see is Dynamic ECH exposed as an actual selectable option in the 3x-ui UI.

Currently, the UI allows users to generate a local ECH keypair, but there is no corresponding option such as:

ECH Mode:

○ Disabled
○ Local ECH
○ Dynamic ECH

This distinction is important for Cloudflare CDN users.

With a direct connection:

Client → Xray

a locally generated ECH keypair makes sense because Xray is the TLS endpoint.

But with:

Client → Cloudflare → Xray

Cloudflare is the client-facing TLS endpoint. Therefore, the ECH configuration generated by Xray locally is not the ECH configuration that the client should use for Cloudflare.

In this case, the client should dynamically obtain Cloudflare's published ECH configuration, for example:

cloudflare-ech.com+https://dns.alidns.com/dns-query

So the problem isn't that Xray cannot do Dynamic ECH. The problem is that 3x-ui currently doesn't present Dynamic ECH as a first-class configuration option.

I would also strongly prefer the DoH resolver to remain configurable rather than hardcoded.

I used AliDNS in the example because this is particularly relevant for users in mainland China. Many commonly used overseas DoH services can be blocked, interfered with, or simply unreliable from that network environment. A Dynamic ECH implementation is only useful if the client can actually reach the configured DoH resolver.

Therefore, something as simple as:

Dynamic ECH
    ECH Domain: cloudflare-ech.com
    DoH Resolver: https://dns.alidns.com/dns-query

would already solve most of the usability problem.

No Cloudflare API integration or separate ECH key management should be necessary if the existing Xray configuration and subscription mechanisms can already handle the domain+DoH_URL format.

In short, I am mainly proposing a UI/UX improvement around an already-supported Xray feature, rather than asking 3x-ui to implement Dynamic ECH from scratch.

<!-- gh-comment-id:6232100273 --> @55575455 commented on GitHub (Oct 17, 2026): ### Clarification Thanks for the analysis. I think the current implementation confirms what I was trying to address. I agree that the underlying Xray configuration and subscription/export mechanisms already support the Dynamic ECH format: ```text <domain>+<DoH_URL> ``` For example: ```text cloudflare-ech.com+https://dns.alidns.com/dns-query ``` So I don't think this requires a major backend implementation. The main thing I would like to see is **Dynamic ECH exposed as an actual selectable option in the 3x-ui UI**. Currently, the UI allows users to generate a local ECH keypair, but there is no corresponding option such as: ```text ECH Mode: ○ Disabled ○ Local ECH ○ Dynamic ECH ``` This distinction is important for Cloudflare CDN users. With a direct connection: ```text Client → Xray ``` a locally generated ECH keypair makes sense because Xray is the TLS endpoint. But with: ```text Client → Cloudflare → Xray ``` Cloudflare is the client-facing TLS endpoint. Therefore, the ECH configuration generated by Xray locally is not the ECH configuration that the client should use for Cloudflare. In this case, the client should dynamically obtain Cloudflare's published ECH configuration, for example: ```text cloudflare-ech.com+https://dns.alidns.com/dns-query ``` So the problem isn't that Xray cannot do Dynamic ECH. **The problem is that 3x-ui currently doesn't present Dynamic ECH as a first-class configuration option.** I would also strongly prefer the DoH resolver to remain configurable rather than hardcoded. I used AliDNS in the example because this is particularly relevant for users in mainland China. Many commonly used overseas DoH services can be blocked, interfered with, or simply unreliable from that network environment. A Dynamic ECH implementation is only useful if the client can actually reach the configured DoH resolver. Therefore, something as simple as: ```text Dynamic ECH ECH Domain: cloudflare-ech.com DoH Resolver: https://dns.alidns.com/dns-query ``` would already solve most of the usability problem. No Cloudflare API integration or separate ECH key management should be necessary if the existing Xray configuration and subscription mechanisms can already handle the `domain+DoH_URL` format. In short, I am mainly proposing a **UI/UX improvement around an already-supported Xray feature**, rather than asking 3x-ui to implement Dynamic ECH from scratch.
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#4551
No description provided.