· Advanced · 8 min read

Clash Proxy Groups: url-test, fallback, and load-balance

Compare how url-test, fallback, and load-balance choose routes, when they switch, and which settings matter—with YAML examples for everyday browsing, reliable failover, and distributing connections.

Choosing a Proxy Group: Latency, Priority, or Load Distribution

The right choice depends on what you need from the same set of proxies. For everyday browsing, use url-test to favor the most responsive route. To keep a preferred route and switch only when it fails, use fallback. To spread connections across multiple routes for concurrent devices or tasks, consider load-balance. The YAML examples below use mihomo 1.19 syntax; don’t assume every field works with older Clash cores.

Type How it chooses a route Best for
url-test Compares probe latency among healthy proxies; switching depends on the tolerance setting Everyday browsing and apps that make frequent short requests
fallback Chooses the first healthy proxy in the configured order Workflows with a designated primary route
load-balance Distributes connections among healthy proxies using the selected strategy Concurrent requests to multiple destinations

Rules determine which proxy group handles a connection; the group then selects a route from its members. Measuring latency in the client after importing a subscription doesn’t mean requests are using an automatic group. If a rule still points to a manual group or DIRECT, automatic route selection won’t take effect.

url-test: Choose Routes by Latency for Everyday Browsing

url-test probes the same URL through each candidate route and selects an exit based on probe latency. This measures the time taken by an HTTP request—not an ICMP ping or a bandwidth test. A faster probe only means that route responded more quickly to the test endpoint; results may differ for sites in other regions or large downloads.

In these examples, Route A, Route B, and Route C stand for three proxy names already defined in your configuration. Replace them with the actual names, then add the relevant example entries under your existing proxy-groups:. Don’t create another top-level key with the same name or reuse an existing group name.

proxy-groups:
  - name: Everyday Latency Test
    type: url-test
    proxies:
      - Route A
      - Route B
      - Route C
    url: https://www.gstatic.com/generate_204
    interval: 300
    timeout: 5000
    tolerance: 80
    lazy: false
  • interval: 300 sets how often health checks run, in seconds. timeout: 5000 sets the probe timeout, in milliseconds. The first controls the time between checks; the second controls how long each check can take.
  • tolerance: 80 sets the switching tolerance in milliseconds. Suppose the current route is healthy at 180 ms and another measures 140 ms—a difference of just 40 ms. The tolerance can prevent a switch for such a small gain. If the other route measures 85 ms, the 95 ms difference may be enough to trigger a switch. These figures are illustrative.
  • lazy: false keeps periodic checks running even when the group isn’t currently in use. This is useful when you want to monitor a small number of proxies continuously. If you have many proxies, narrow the candidate list first, then decide whether continuous probing is necessary.

fallback: Keep a Preferred Route Until It Fails

fallback follows the configured order and proxy health, not latency rankings. In the example below, Route A comes first and Route B second. Even if Route B measures 90 ms and Route A measures 240 ms, new connections prefer Route A as long as it’s considered healthy. Only when Route A is unavailable does the group look for a working route farther down the list. Once Route A passes its health check again, new connections can prefer it again.

proxy-groups:
  - name: Primary-Fallback
    type: fallback
    proxies:
      - Route A
      - Route B
      - Route C
    url: https://www.gstatic.com/generate_204
    interval: 60
    timeout: 5000
    lazy: false

A primary/fallback group is a good fit when you have only a few candidates and want to keep the exit route as consistent as possible. interval: 60 schedules a check every 60 seconds; it doesn’t guarantee recovery within 60 seconds of a failure. Switching depends on when the group detects a health change and when the next connection is made. Downloads, calls, and remote sessions that have already dropped won’t resume over the backup route automatically—the app must reconnect.

load-balance: Distribute New Connections Across Routes

The goal of load-balance isn’t to find the route with the lowest latency; it’s to distribute new connections across healthy proxies. For concurrent tasks to multiple destinations, try consistent-hashing: it maps each destination to an exit, so the same destination tends to use the same route while the candidate set remains stable. The mapping may change if a candidate fails or recovers.

proxy-groups:
  - name: Concurrent Load Distribution
    type: load-balance
    strategy: consistent-hashing
    proxies:
      - Route A
      - Route B
      - Route C
    url: https://www.gstatic.com/generate_204
    interval: 300
    timeout: 5000
    lazy: false

If tasks are independent and connections to the same destination can use different exits, set strategy to round-robin to cycle through available proxies. Round-robin distributes connections, not bytes: a connection for a large file and one for a short request each count as a single selection. This doesn’t mean three routes will each carry one-third of the traffic.

A single TCP connection also can’t be split across multiple routes to make it faster. When a browser reuses an HTTP/2 connection, opening several pages won’t necessarily create the same number of new connections. A logged-in site may also contact multiple domains, so hashing by destination doesn’t guarantee that the entire sign-in flow uses one exit. If you need a fixed exit, route the relevant domains explicitly through a specific proxy.

Subscription Config and Health Checks: Where to Set Each Option

List Proxies Directly or Use a Subscription Provider

The examples above list group members directly under proxies:, with the group’s probe settings checking those candidates. If a group uses use: to draw from a proxy collection under proxy-providers:, set enable, url, and interval under the relevant provider’s health-check:. Don’t treat the group’s probe URL as the health-check configuration for that collection. The provider’s interval, which refreshes the subscription, is also different from the interval under health-check, which checks proxy availability.

Probe Targets and Configuration Persistence

  • Test endpoint: The examples use a lightweight endpoint that typically returns HTTP 204. If all proxies time out at once, rule out an endpoint outage, DNS resolution issue, or a destination that’s unreachable from your current routes before changing the test URL. A successful probe doesn’t mean every service is working.
  • Probe overhead: If a group lists 30 proxies directly, reducing the probe interval from 300 to 60 seconds increases the estimated check rounds for the same set from about 12 to about 60 per hour. Start with three to five representative routes. It’s easier to diagnose issues than by repeatedly testing an entire subscription.
  • Subscription updates: Refreshing a subscription may overwrite direct configuration edits or change proxy names. If your client supports persistent overrides or configuration merging, save custom groups and rules in the appropriate configuration layer. After an update, check that group references still resolve and that the merged configuration is active.

Verify Connections: Check Rule Matching Before Route Changes

  1. Add a dedicated test rule. In your existing rules:, place DOMAIN,example.com,Everyday Latency Test before any rule that might match the domain first and before the fallback MATCH rule. Test in Rule mode; this rule won’t determine routing if Global mode is enabled.
  2. Confirm that requests reach the core. For example, use the command below to explicitly specify the local HTTP proxy only if you’ve confirmed that this device’s mixed-port is 7890. If the port differs, use the one shown in your client settings. You don’t need to enable TUN to verify this route. If your browser uses the proxy but another app doesn’t, check whether that app follows the system proxy settings and whether TUN is needed to capture its traffic.
  3. Check the outbound route. First, use the client’s connection history or logs to confirm that the test domain matched the expected rule. Then check which group and proxy handled the request. To test primary/fallback behavior, you can temporarily remove the primary proxy in a local test configuration and verify that new requests use the backup. To see health checks trigger a switch, make the primary unavailable in a controlled environment, wait for its status to update, then start a new connection. These tests verify different things—the backup route and failure detection—so don’t treat them as interchangeable.
curl --proxy http://127.0.0.1:7890 --max-time 15 https://example.com/

Finally, adjust the configuration based on what you observe. If routes keep switching despite similar latency, increase tolerance. If primary/fallback doesn’t switch, first check whether the primary can still reach the test endpoint. If load balancing seems to keep using one route, try several different destinations and confirm that each test creates a new connection. Comparing connection logs with your expectations is more useful than looking at latency figures alone when tracking down the layer causing the issue.

Download the Latest Clash Version