Choosing a Clash Proxy Group

To choose an exit manually, use select. To pick one based on latency tests, use url-test. To keep a fixed primary-and-backup order, use fallback. To distribute different connections across multiple proxies, use load-balance. Automatic strategies don't change which rules match; they only choose the outbound route after traffic hits the group.

How the Four Proxy Groups Work
TypeSelection methodBest for
selectUses the member you selected manuallyChoosing a fixed exit and testing proxies one by one
url-testSelects by measured latency, with a configurable switching marginMultiple proxies for the same purpose, with response time as a priority
fallbackPrefers the first member in the list that passes its availability checkPrefers the primary proxy and switches to a backup if it fails
load-balanceAssigns each new connection to an available member according to the configured strategyConcurrent requests to multiple destinations when different exits are acceptable

When troubleshooting, separate the three layers: rules determine which group a connection matches, proxy-groups determine how a member is selected, and proxies define the proxies themselves. System proxy and TUN mode determine how traffic enters the core; changing how traffic is captured doesn't turn a manual group into an automatic one. To test the rules below, set the client to Rule mode and make sure traffic is reaching the core.

Auto-testing vs. Failover vs. Load Balancing

url-test: When the tolerance triggers a switch

tolerance is measured in milliseconds; it isn't a maximum latency limit for a proxy. Suppose the current proxy measures 120 ms, another measures 100 ms, and the tolerance is set to 50 ms. As long as the current proxy is available, a 20 ms advantage isn't enough to trigger a switch. If the other proxy measures 60 ms, the 60 ms difference exceeds the tolerance. These are example calculations, not measurements from actual proxies. Probe latency also doesn't indicate download bandwidth: a proxy with a faster probe may not transfer large files faster.

fallback: Availability comes before latency

Put the primary proxy first in the proxies list. As long as it's considered available, the group won't switch to a faster backup just because of the latency difference. If the primary is marked unavailable, new connections can use the next available member. Once the primary recovers and passes a new check, it becomes the preferred option again. Failover doesn't migrate existing connections; interrupted downloads or sessions may still need to reconnect in the app.

load-balance: Distributes connections, not bandwidth for a single connection

consistent-hashing hashes traffic based on its destination. While the set of candidate proxies stays stable, the same destination tends to use the same exit. round-robin assigns each new connection to the next available proxy in turn. A browser may send multiple requests over one HTTP/2 connection, so refreshing repeatedly doesn't necessarily create new connections—and can't confirm that round-robin is working. If a session needs to keep the same exit, use select: hashing doesn't guarantee that different destination domains share one exit, and changes in proxy availability can trigger reassignment.

mihomo Proxy Group YAML Examples

These examples use fields supported by the mihomo v1.19 series. The core listens locally on mixed-proxy port 7890; the two SOCKS5 example proxies point to local ports 10801 and 10802. A separate SOCKS5 service must already be listening on each port, or the probes will fail. If you already have a subscription, keep your existing proxy definitions and replace Proxy-A and Proxy-B in each group with names that actually exist in your configuration. Don't point a proxy back to the core's own mixed-proxy port.

mixed-port: 7890
allow-lan: false
mode: rule

proxies:
  - name: Proxy-A
    type: socks5
    server: 127.0.0.1
    port: 10801
  - name: Proxy-B
    type: socks5
    server: 127.0.0.1
    port: 10802

proxy-groups:
  - name: Manual
    type: select
    proxies:
      - Proxy-A
      - Proxy-B
      - Auto-test
      - Failover
      - Load balance

  - name: Auto-test
    type: url-test
    proxies: [Proxy-A, Proxy-B]
    url: https://www.gstatic.com/generate_204
    interval: 300
    timeout: 5000
    tolerance: 50
    lazy: false

  - name: Failover
    type: fallback
    proxies: [Proxy-A, Proxy-B]
    url: https://www.gstatic.com/generate_204
    interval: 300
    timeout: 5000
    lazy: false

  - name: Load balance
    type: load-balance
    strategy: consistent-hashing
    proxies: [Proxy-A, Proxy-B]
    url: https://www.gstatic.com/generate_204
    interval: 300
    timeout: 5000
    lazy: false

rules:
  - DOMAIN-SUFFIX,example.com,Manual
  - MATCH,DIRECT
  • interval: 300 sets the probe interval to 300 seconds. timeout: 5000 sets the timeout for a single probe to 5,000 milliseconds. This doesn't guarantee failover within that time—the core must first detect and mark the proxy unavailable.
  • lazy: false lets the group run scheduled probes even when it isn't selected, making it easier to compare the three automatic strategies. For everyday use, there's no need to keep three automatic groups probing the same set of proxies; that would duplicate the checks.
  • url checks whether a proxy can reach the specified probe URL. If several proxies time out at once, first check whether they can reach that URL. Then consider switching to a lightweight HTTPS endpoint that all of them can access reliably. A successful probe doesn't guarantee access to other service domains.

How to Verify Proxy Group Switching

  1. First, confirm both proxies work on their own. In the client, select the test configuration under “Profiles,” then go to “Proxies” → “Manual” and select Proxy A and Proxy B in turn. Reopen https://example.com/ each time. If port 7890 is already in use, choose an available port and configure the test app to use that same port.
  2. Next, confirm the connection matches the intended group. Open “Connections” and check the new connection's destination, matched rule, and outbound chain. In this example, example.com should match “Manual”; all other destinations fall through to the final MATCH,DIRECT rule. If you merge these rules into an existing subscription, place the test rule before any broad rules that could match first.
  3. Finally, verify the primary-and-backup order. In “Manual,” select “Failover.” After confirming the primary is available, stop the local test service for Proxy A. Wait for the next probe, or trigger a latency test for the group if your client supports it. Then create a new connection and check whether it uses Proxy B. Restart Proxy A and check again to confirm it becomes the preferred proxy.

If the Proxies page shows that the route changed but the app still reports the old exit, close the existing connection before testing again. If a new connection still uses the old exit, check its matched rule and outbound chain under “Connections”—don't rely on latency figures alone. If the core isn't receiving new connections at all, check whether the app follows the system proxy settings or whether TUN is capturing its traffic. Interface labels vary by client; use newly created connection records to verify the result.