CODENAME: CLASH / CONNECTION TIMEOUT BRIEFING

DOC-01

Identify the failure before changing the configuration

“ChatGPT does not work with Clash” describes several different failures. A browser may show a blank page, return a gateway error, remain stuck on “Loading,” reject the login request, or open the interface while every conversation request times out. These symptoms do not necessarily have the same cause. Changing the subscription immediately can hide the evidence and make diagnosis slower.

Start by separating the connection into four layers: the local Clash listener, the selected proxy node, the routing decision, and the destination-side DNS and TLS connection. If the local listener is not running, no application can reach Clash. If the listener works but the node is unavailable, all proxied destinations may fail. If only ChatGPT fails, the likely candidates become routing rules, DNS resolution, TLS negotiation, or a destination-specific restriction.

Observed symptom Most likely area First check
Every website times out Local port, node, system proxy, or firewall Check whether Clash is running and whether a node latency test succeeds
Other overseas sites work, ChatGPT does not Routing rule, DNS, TLS, or service-specific endpoint Inspect the request log and verify the policy matched by ChatGPT domains
ChatGPT page opens but login loops Authentication domains, cookies, DNS, or unstable exit IP Check requests to authentication and challenge-related domains
Page loads but messages time out Long-lived connection, unstable node, or streaming path Test another node in the same group and watch the live connection log
Only TUN mode fails Virtual adapter, permission, route, or DNS hijack Disable TUN temporarily and compare with system proxy mode

Use a private browser window only as a secondary test. It can distinguish stale cookies or extensions from network problems, but it does not prove that the proxy path is healthy. Also test a normal, non-sensitive website and one service known to require the same general network path. The objective is to establish a baseline, not to repeatedly refresh the ChatGPT tab.

DOC-02

Check the node, proxy group, and operating mode

A timeout is often caused by a dead or overloaded node rather than by ChatGPT itself. A node can still appear in the profile while its server is unreachable, its port is blocked, its credentials have expired, or its available bandwidth is exhausted. A latency value of N/A, a failed URL test, or repeated connection failures in the Clash log is stronger evidence than the node’s name or position in the subscription list.

Open the client’s proxy page and select a different node from the same provider. Prefer a node in another region or on a different transport when the first alternatives fail. Do not test ten nodes at once and conclude that the whole service is broken; first test one known ordinary website, then ChatGPT, and record the result. If every node fails for every destination, investigate the local client, subscription, network, or provider status. If one node fails while others work, remove that node from consideration instead of editing unrelated rules.

Next, confirm the active mode. Rule mode is normally the correct daily setting because it evaluates the configuration’s rules and sends each request to the designated policy. Global mode sends matched traffic through one selected proxy group or node, depending on the client interface. Direct mode bypasses the proxy. Names and controls differ between clients, so read the actual mode indicator rather than assuming that a selected node means all traffic is using it.

  1. Set the client to Global mode temporarily and select a node that passes the client’s connectivity test.
  2. Open ChatGPT and check whether the landing page, login flow, and a new conversation all complete.
  3. Switch back to Rule mode and repeat the same test without changing the node.
  4. If Global works but Rule fails, inspect the rules and policy group. If both fail, focus on the node, DNS, TLS, or local network.
  5. Use Direct mode only as a comparison. A direct failure does not prove that the proxy is broken; it may simply reflect the network path available without the proxy.
Note

Global mode is a diagnostic control, not a permanent repair. It can bypass a bad rule, but it may also route local services unnecessarily through the proxy and make later results harder to interpret.

DOC-03

Inspect routing rules and the actual request log

In Rule mode, the important question is not “Is a proxy selected?” but “Which policy did Clash assign to this request?” A broad DOMAIN-KEYWORD rule, an incorrectly ordered DOMAIN-SUFFIX rule, or a final DIRECT catch-all can send ChatGPT traffic outside the intended path. The first matching rule wins. Rules below that match are never evaluated.

ChatGPT’s web experience may contact several hostnames rather than a single domain. Common examples can include chatgpt.com, openai.com, auth.openai.com, api.openai.com, and challenge or content delivery domains. The exact set can change with the web application, account flow, browser, and service infrastructure. Do not copy a hostname from one request and assume it covers the entire session.

Use the Clash connection panel or live log while opening the site. Search by hostname and note four values: the requested domain, the matched rule, the selected policy, and whether the connection ends in success, timeout, reset, or DNS failure. This is more reliable than adding a large collection of guessed domains to the configuration.

rules:
  - DOMAIN-SUFFIX,chatgpt.com,ChatGPT
  - DOMAIN-SUFFIX,openai.com,ChatGPT
  - DOMAIN-SUFFIX,auth.openai.com,ChatGPT
  - DOMAIN-SUFFIX,api.openai.com,ChatGPT
  - MATCH,Proxy

The example assumes that a proxy group named ChatGPT already exists. If the group does not exist, the configuration may fail validation or the client may substitute an unexpected policy. Replace the group name with one that actually appears under proxy-groups in the imported profile.

Place specific rules above broad rules. For example, a previous DOMAIN-SUFFIX,openai.com,DIRECT entry will override a later proxy rule for api.openai.com. Likewise, a GEOIP,CN,DIRECT rule usually does not explain a domain-based failure by itself, but an IP-CIDR rule, a private-network rule, or a provider-generated rule set can take precedence. Review the complete order rather than editing only the visible custom section.

Caution

Do not route every unknown domain through a guessed policy simply because the page looks incomplete. Login, static assets, challenge services, analytics, and API requests can use different hostnames. Read the request log, add only justified rules, and keep a final catch-all policy that is intentional.

DOC-04

Apply a controlled repair sequence

This section is the practical runbook. Perform the steps in order and change one variable at a time. A controlled sequence preserves the distinction between a node problem and a configuration problem.

  1. Confirm the local listener. In the Clash dashboard, verify that the HTTP or mixed port is enabled and note its port number. If the client uses a mixed port, do not manually configure the browser as SOCKS5 unless the client explicitly exposes a SOCKS5 listener on that port.
  2. Test the selected node. Run the client’s URL or latency test, then open a simple external website. A successful latency test is not a complete guarantee, but a failed test makes ChatGPT troubleshooting premature.
  3. Clear temporary application state. Close the ChatGPT tab, restart the browser, and test a private window. If the private window works, disable extensions selectively and clear site data for ChatGPT and OpenAI domains. Avoid deleting all browser data before confirming that stale state is involved.
  4. Compare Global and Rule modes. Keep the same node while changing only the mode. Record whether the page, login, and message submission each work. This comparison identifies rule matching as a likely cause without requiring a new subscription.
  5. Inspect the connection log. Filter for ChatGPT, OpenAI, authentication, and challenge-related hostnames. Look for a direct policy, an unexpected group, repeated retries, or a DNS error. A hostname resolving but failing to establish TLS points to a different layer than a hostname that cannot resolve at all.
  6. Add narrow rules if justified. Place the required domain-suffix rules above conflicting direct rules and reference an existing proxy group. Save or create a local override rather than repeatedly modifying the provider’s remote profile if the client supports overrides.
  7. Restart the core after validation. Validate the YAML first. Then reload the profile or restart the Clash core so that the revised rules, DNS settings, and proxy group are actually active. A file saved on disk is not necessarily the configuration currently loaded in memory.
  8. Return to the normal operating mode. Use Rule mode after the comparison unless Global mode is an explicit requirement. Test the landing page and one message, then monitor the log for a few minutes instead of continuously changing nodes.

When a configuration contains provider-managed rule sets, use the client’s configuration preview or merged-config view if available. That view shows the effective order after remote rules, local overrides, and generated rules have been combined. Editing the source profile alone may not change the final rule order.

DOC-05

Resolve DNS, TUN, and transport conflicts

DNS failures can look like ordinary timeouts. If the resolver returns an unreachable address, leaks a local answer that does not match the intended proxy path, or is intercepted by another network component, Clash may never establish the destination connection. Check the DNS section of the active configuration and the DNS-related entries in the runtime log. Also check whether the browser is using its own secure DNS resolver, because browser-level DNS can bypass assumptions made about Clash’s resolver.

In fake-IP mode, Clash returns synthetic addresses and maps them back to domain names inside the core. This can improve rule matching for applications that connect by IP after DNS resolution, but it requires compatible fake-IP filtering and correct DNS handling. In redir-host mode, the real resolved address is returned instead. Neither mode is automatically better for every environment. A fake-IP filter that excludes a required domain, or a browser resolver that bypasses Clash, can create a failure that appears to be a node timeout.

For a clean comparison, temporarily keep the DNS design simple. Use a resolver configuration supported by the selected core, avoid mixing several unrelated DNS interception mechanisms, and make sure the client’s DNS hijack setting points to the correct local DNS listener when TUN mode is enabled. Exact field names vary between Clash Meta and mihomo-based clients, so validate against the core’s accepted schema rather than pasting options from an older Clash version.

TUN mode adds another possible failure point. It captures traffic at the virtual network interface and can cover applications that ignore system proxy settings, but it also depends on administrator permission, a working virtual adapter, routing-table changes, and correct DNS interception. If ChatGPT works in system proxy mode but times out only with TUN enabled, disable TUN and compare the route and DNS behavior. Check for conflicts with VPN software, endpoint security products, virtual machines, and other packet filters.

Comparison Result Interpretation
System proxy works, TUN fails Browser succeeds only after TUN is disabled Investigate virtual adapter permissions, route conflicts, DNS hijack, or another VPN driver
Global works, Rule fails Same node succeeds in Global mode Inspect rule order, policy group names, and direct or reject rules
Rule and Global both fail Different modes produce the same timeout Test another node, DNS behavior, firewall access, and the upstream network
Page works, message streaming fails Initial HTML loads but response hangs Inspect long-lived connections, node stability, browser extensions, and transport handling
DOC-06

Decide whether the provider is the actual problem

Switching providers should be the final diagnostic step, not the first reaction to one timeout. Provider-side problems become more plausible when every node fails the same destination, multiple devices show the same result, the subscription updates normally but connection attempts are rejected, or the provider confirms an outage. An unstable exit address can also cause repeated authentication challenges or inconsistent access while ordinary websites continue to work.

Before changing provider, retain a short test record: date and time, client and core versions, operating mode, DNS mode, selected node region, matched policy, and the exact error shown by the browser. Do not include account credentials or private subscription URLs in support messages. This record prevents the same local mistake from being reproduced with a new profile.

A new provider is unlikely to fix a local port conflict, a disabled system proxy, a TUN permission failure, a browser extension, or a rule that sends traffic directly. It may provide a more stable node, but the configuration still needs to be validated after import. Recheck the active mode, proxy group, DNS path, and effective rules rather than assuming that a newly downloaded profile is correct for every client.

Resolution

The most reliable workflow is controlled comparison: verify the local listener, test one healthy node, compare Global with Rule mode, inspect the matched policy, then check DNS and TUN only when the evidence points there. This sequence usually identifies the failing layer without replacing a working subscription.

Get the Clash client

Use the download page for the appropriate platform, then import your existing configuration and apply the troubleshooting sequence above. The client provides the proxy engine and rule controls; node availability remains dependent on the subscription provider.

DOC-01

Where the DNS block fits in Clash and what it does

In a Clash config file, the dns block is a module independent from proxies and rules. It doesn't decide which proxy node traffic uses — it handles exactly one thing: how domain names resolve into IP addresses. This step happens before rule matching — once Clash gets a domain, it needs to know the corresponding IP before it can evaluate GEOIP, IP-CIDR, and similar rules to decide routing. If the dns block is misconfigured, rule-based routing accuracy is directly affected. A typical symptom: a direct-connection rule is written, yet traffic still goes through the proxy, or vice versa.

The core fields in the dns block include enable (whether Clash handles DNS resolution itself), listen (the listening address, usually paired with TUN mode), enhanced-mode (fake-ip or redir-host), nameserver (the primary resolver list), fallback (the backup resolver list), and fallback-filter (rules that decide when fallback kicks in). These fields work together to form the complete resolution chain.

Note

When the dns block is disabled (enable: false), Clash hands DNS resolution off to the operating system and only forwards traffic. In most scenarios it's recommended to enable it for more precise routing control.

DOC-02

How nameserver and fallback divide labor

nameserver is the primary resolver list — Clash uses these servers to resolve domains first. fallback is the backup resolver list, only used when specific conditions are triggered. It's not simply "switch to fallback if nameserver fails."

Common nameserver setups

It's recommended to fill in servers with fast resolution speed and close geographic proximity from your ISP. A common combination mixes local public DNS with your carrier's DNS:

nameserver:
  - 223.5.5.5
  - 119.29.29.29
  - 114.114.114.114

What triggers fallback

fallback is usually filled with resolvers located outside your region or across networks, such as 1.1.1.1 or 8.8.8.8. It's not an unconditional backup — it works together with fallback-filter. Only when the result resolved via nameserver is judged "untrustworthy" (for example, falling outside the geoip range, or matching specific rules) does Clash switch to fallback and re-resolve. The point of this mechanism: local domains resolved via local DNS get the nearest CDN node, reducing latency, while domains that are censored or need proxy access get resolved via clean overseas DNS instead, avoiding incorrect results.

fallback:
  - tls://1.1.1.1:853
  - tls://8.8.8.8:853

fallback-filter:
  geoip: true
  geoip-code: CN
  ipcidr:
    - 240.0.0.0/4
  domain:
    - +.google.com
    - +.facebook.com

The config above means: if the IP resolved via nameserver doesn't belong to mainland China (outside geoip-code: CN), or matches a domain in the domain list, the result is treated as untrustworthy, and Clash re-queries using the servers under fallback instead. This way, censored domains get correct results from overseas resolution, while local sites still use the fastest local DNS.

DOC-03

fake-ip vs redir-host: how the two enhanced modes differ

The enhanced-mode field determines how Clash handles DNS resolution results, with two options: fake-ip and redir-host. These two modes have different design goals and different use cases.

fake-ip mode

In fake-ip mode, Clash intercepts DNS query requests and doesn't return the real IP a domain maps to. Instead it returns a virtual IP from a reserved address range (198.18.0.0/16 by default). The application connects using this virtual IP, and as traffic passes through, Clash restores the virtual IP back to the real domain, hands it to the rule engine for routing decisions, and finally resolves the real IP for forwarding.

The advantage of this mode is faster resolution (no need to wait for a real DNS query every time), and rule matching can be done directly by domain rather than relying on IP, which is more accurate. When paired with TUN mode, fake-ip is nearly the standard choice. The downside is that some software with a strong dependency on IP addresses (certain game networking features, LAN discovery protocols) may misbehave after receiving a virtual IP, requiring those domains to be excluded individually in fake-ip-filter.

dns:
  enable: true
  enhanced-mode: fake-ip
  fake-ip-range: 198.18.0.0/16
  fake-ip-filter:
    - "*.lan"
    - "*.local"
    - "+.stun.*.*"
    - "time.*.com"

redir-host mode

In redir-host mode, Clash queries nameserver/fallback for the real IP directly and returns it to the application, with no virtual address substitution. Rule matching depends on this real IP, or on the domain-to-IP mapping recorded during the query stage. This mode has better compatibility — applications rarely misbehave from receiving a "fake" address — but resolution overhead is higher, and rule matching is less precise than fake-ip in some complex scenarios.

Reminder

Without specific compatibility issues, it's recommended to default to fake-ip. Only consider switching to redir-host, or adding targeted exclusions in fake-ip-filter, when you run into LAN device discovery failures, client connection issues, and have confirmed the DNS mode is the cause.

DOC-04

Detecting and handling DNS hijacking

DNS hijacking refers to a resolution request being tampered with in transit by an intermediate node, returning an incorrect IP address, which redirects access to an ad page, an error page, or breaks connectivity outright. A common way to detect hijacking is resolving the same domain using different DNS servers and comparing the results — if your local ISP's DNS returns an IP that's noticeably different from a known public DNS, and access is behaving abnormally, hijacking or censorship is very likely.

In Clash's case, the fallback-filter mechanism itself is one way of dealing with DNS hijacking: it judges whether a result is trustworthy using geoip and domain lists, and re-queries with a different set of servers if it isn't. Beyond that, consider the following:

dns:
  enable: true
  use-hosts: true
  nameserver:
    - https://223.5.5.5/dns-query
    - https://120.53.53.53/dns-query
  fallback:
    - tls://1.1.1.1:853
    - tls://8.8.4.4:853
  fallback-filter:
    geoip: true
    geoip-code: CN

hosts:
  example.local.test: 127.0.0.1

Note that DNS hijacking and proxy rule routing are two different layers of problems. If the proxy node itself works but a specific website consistently fails, check whether the issue is in DNS resolution first, rather than assuming the node or the rules are wrong. Conversely, if several DNS servers all return the same, correct result but access still fails, the problem is more likely in the proxy node or rule matching.

DOC-05

Anti-leak checklist and a full example

DNS leak refers to a domain resolution request that should have gone through the proxy instead bypassing Clash and going straight to the system's default DNS server, exposing the actual site being accessed. To avoid leaks, pay attention to the following:

  1. Confirm that system-level proxy settings or TUN mode have correctly taken over traffic — don't enable proxying for only some apps while leaving the system-level DNS query channel uncovered.
  2. The enable field in the dns block must be true, otherwise Clash won't intervene in resolution and all queries go through the system's default path.
  3. It's recommended to explicitly set the listen field, e.g. 0.0.0.0:1053, and confirm that DNS requests at the OS or router level are correctly forwarded to this listening port rather than bypassing it via the system's built-in DNS client.
  4. When TUN mode is enabled, confirm that the dns fake-ip or redir-host mode is consistent with TUN's stack configuration, to avoid two resolution logics conflicting and letting some requests slip through.
  5. Use nameservers that support DoH/DoT to reduce the chance of your carrier observing or tampering with queries at the transport layer.

Below is a complete dns block example that combines all the points from this article, ready to drop directly into a config file — just adjust the specific nameserver and fallback addresses to match your actual nodes:

dns:
  enable: true
  listen: 0.0.0.0:1053
  ipv6: false
  use-hosts: true
  enhanced-mode: fake-ip
  fake-ip-range: 198.18.0.0/16
  fake-ip-filter:
    - "*.lan"
    - "*.local"
    - "+.stun.*.*"
  default-nameserver:
    - 223.5.5.5
    - 119.29.29.29
  nameserver:
    - https://223.5.5.5/dns-query
    - https://120.53.53.53/dns-query
  fallback:
    - tls://1.1.1.1:853
    - tls://8.8.4.4:853
  fallback-filter:
    geoip: true
    geoip-code: CN
    ipcidr:
      - 240.0.0.0/4
    domain:
      - +.google.com
      - +.github.io

The default-nameserver field deserves a separate note: it's used specifically to resolve the DoH server addresses written as domain names under nameserver and fallback (for example, 223.5.5.5/dns-query in the example above is already an IP, but if it were written as a domain-based DoH address instead, default-nameserver would need to resolve the DoH server's own IP first, before it can be used to query the actual user domain). This is an easily overlooked detail that affects whether the whole resolution chain actually works.

Key point

After finishing the config changes, it's recommended to restart the client or reload the config, then test both local and overseas sites separately for speed and connectivity to confirm the fallback-filter logic works as expected before relying on it day to day.

Get the Clash Client

Once the DNS block is configured, you still need a matching client and subscription rules for it to take effect. Head to the download page to get the installer for your platform, or check the tutorials for the full setup process.

Download Clash