1 Do not confuse “fastest in pool” with “primary then spare”
In Clash-family configs, each entry under proxy-groups has a type that defines selection semantics. url-test is optimized for picking a comparatively low-latency outbound among several peers that you consider interchangeable—think “any of these Hong Kong nodes is fine, just keep me on the snappiest one right now.” The core issues HTTP probes toward url, records round-trip time per candidate, and may switch winners after each interval according to rules discussed below.
fallback is different: it behaves like a prioritized chain. The core tries the first proxy in the list while it passes health checks; when that proxy times out or fails repeatedly, it advances to the second, then the third, and so on. That matches operational language such as “use my premium line first, then a cheap relay, then DIRECT” rather than “always minimize milliseconds across the entire set.” If you need strict primary/secondary behavior, fallback is the closer mental model; if you need continuous competition between nodes of equal standing, url-test fits better.
Both types share plumbing—there is still a probe url and a polling cadence interval—but the switching policy diverges. The optional tolerance field dampens oscillation in url-test; ordering, not raw latency ranking, drives fallback. Throughout this guide we assume Clash.Meta / Mihomo or a GUI that emits the same schema. If you are still converting non-Clash subscription links into YAML, read our subscription converter guide first so your proxies list is populated before you tune groups.
2 Prerequisite: every name in proxies: must exist
Policy groups reference other objects by string name. Each item inside proxy-groups[].proxies must match either a concrete outbound defined under proxies, another policy group name for nesting, or built-in keywords such as DIRECT and REJECT. When an airport renames nodes after maintenance, stale references break validation or silently drop entries in GUIs, which looks like “my auto group is empty.” After every subscription refresh, skim the node list and align group membership with reality.
Operational tip: keep url-test pools within a single region or role. Mixing continents inside one url-test group produces meaningless comparisons—a 40 ms Tokyo server and a 200 ms Los Angeles server are not interchangeable just because the second number is larger; routing policy, peering, and content locality still matter. Separating pools per region and then chaining regions with fallback (next section) tends to behave more predictably than one giant global latency derby.
For headless servers, pair this article with the Linux Mihomo systemd guide so your service unit, working directory, and config.yaml path stay consistent while you iterate on groups. On desktops, the same YAML flows into Clash Verge Rev or similar clients; the concepts do not change—only how you edit and reload.
rules decide which group applies to each flow. Confirm mode: rule when you expect split routing—global modes can bypass the elaborate group graph you just authored.
3 url-test: automatic latency selection
The snippet below shows a conventional url-test block. Replace proxy names with yours. The probe target url should be a lightweight HTTP endpoint that returns quickly; many profiles use http://www.gstatic.com/generate_204 because it is small and widely documented, though any stable URL your network can reach is valid if it behaves consistently.
interval sets how often the core re-runs probes (seconds). tolerance is the hysteresis band: url-test will not jump to another node unless the improvement exceeds this many milliseconds compared to the currently selected node. That prevents flapping when two servers sit within a few milliseconds of each other. lazy: true delays background probing until the group actually carries traffic, which helps laptops and phones; set false if you prefer immediate population of latency tables at startup.
proxy-groups:
- name: "Auto HK"
type: url-test
url: http://www.gstatic.com/generate_204
interval: 300
tolerance: 50
lazy: true
proxies:
- hk-01
- hk-02
- jp-01
If you observe “another node is faster in the panel but the group never moves,” tolerance is the first knob to revisit. If numbers look random, verify the probe URL is not blocked or intercepted on your path. DNS inconsistencies can also distort perceived latency: when FakeIP and system resolvers disagree, symptoms resemble proxy failure even when the group logic is fine. Our Meta DNS leak prevention guide walks through resolver alignment in depth.
Avoid mixing DIRECT with remote outbounds inside the same url-test unless you truly intend to compare incompatible paths. Direct probes measure your ISP circuit, while remote nodes measure tunnel RTT; merging them produces misleading rankings and odd GUI displays.
4 fallback: ordered failover, not “pick minimum RTT”
Fallback walks the list top to bottom. The core sticks with the earliest proxy that remains healthy under the same HTTP probe parameters. When that proxy fails repeatedly, it falls through to the next entry. The last slot sometimes uses DIRECT as a break-glass path when every remote fails; whether that is acceptable depends on your policy—some teams prefer to end on REJECT instead of leaking plaintext traffic.
proxy-groups:
- name: "Failover chain"
type: fallback
url: http://www.gstatic.com/generate_204
interval: 300
proxies:
- primary-line
- backup-relay
- cold-spare
- DIRECT
Notice that the third node is not “slower”—it is simply lower priority. If your fastest server sits third, it will not see traffic until both predecessors fail. That surprises newcomers who expect fallback to behave like url-test. If you actually want continuous re-evaluation among peers, stay with url-test or a manual select group instead.
load-balance where supported. fallback and url-test solve different problems than per-connection hashing.
5 Combine url-test pools with a regional fallback chain
A robust pattern is: build per-region url-test groups for intra-region competition, then place those group names inside a fallback list for inter-region disaster recovery. Traffic first tries the preferred region’s auto pool; if that entire pool is unhealthy (or you reorder manually in some workflows), the chain advances. Nesting is straightforward because policy groups can reference other groups by name exactly like ordinary proxies.
proxy-groups:
- name: "HK auto"
type: url-test
url: http://www.gstatic.com/generate_204
interval: 300
tolerance: 40
proxies:
- hk-a
- hk-b
- name: "JP auto"
type: url-test
url: http://www.gstatic.com/generate_204
interval: 300
tolerance: 40
proxies:
- jp-a
- jp-b
- name: "Proxy chain"
type: fallback
url: http://www.gstatic.com/generate_204
interval: 300
proxies:
- HK auto
- JP auto
- DIRECT
Logs become easier to read: you can see whether the failure happens inside HK auto or only when the fallback layer escalates. That structure also mirrors how operators think—optimize inside a PoP, then decide which PoP should win externally.
6 Hook groups into rules
After you name a group, reference that exact string from rules. A minimal tail might send China destinations direct and send everything else to Proxy chain. Typos, invisible Unicode characters, or renamed Emoji prefixes are frequent causes of “rule points to a group that does not exist” errors. GUI users still edit the same underlying YAML; verifying the text diff after UI changes catches accidental renames.
rules:
- GEOIP,CN,DIRECT
- MATCH,Proxy chain
Real profiles interleave RULE-SET lines, domain keywords, and LAN exceptions above the final MATCH. Policy groups do not fix ordering mistakes: if a broad rule fires first, your carefully tuned url-test never sees the traffic. When debugging, follow the connection log top-down to see which rule matched before questioning the outbound.
7 Troubleshooting checklist
- Probe URL blocked or unstable: Try alternate lightweight endpoints documented for your region; captive portals and ISP middleboxes sometimes break predictable 204 responses.
- Too aggressive
interval: Sub-second probing wastes battery on mobile hardware and spams logs on routers. Hundreds of seconds is usually enough for consumer use. - Expecting fallback to minimize RTT: Re-read the ordered list; reorder if priorities changed.
- Subscription drift: Reconcile renamed nodes after provider updates; stale names silently disappear from groups.
- TUN vs system proxy mismatch: Applications that bypass the OS proxy still need TUN capture—see our Clash Verge Rev TUN guide when only some apps respect routing.
8 Wrap-up
url-test groups continuously compare peers and favor the lowest-latency candidate within tolerance bounds. fallback groups honor explicit ordering and slide forward only when health checks fail. Combining nested url-test pools with an outer fallback yields a structure that mirrors how many teams operate: compete inside a city or provider, then fail across regions when necessary.
Getting value from either type still requires coherent DNS, sane rule ordering, and subscription names that stay in sync. Compared with clicking nodes manually every day, expressing the policy in YAML scales better—especially when multiple devices import the same profile. A desktop GUI with connection logs simply makes the same underlying Mihomo behavior easier to observe.
When you need installers, use the official site download page rather than random mirrors. Grab builds for your platform, import the profile, and verify in the log that the expected policy group handles your test traffic.