Check rule matches in order
Rule mode does not guess where traffic should go based on app names. Instead, the core checks each connection against the rules from top to bottom. Domain suffixes, keywords, and IP ranges serve different needs. Once a rule matches, the connection is handed to its specified policy, and later rules are usually skipped. Put specific exceptions before general rules and place the fallback MATCH rule last. After making changes, find the target domain in the logs and check the matched rule type and policy name. Adjust the order if needed, rather than mistaking a connection issue for a proxy group issue.
View Clash custom rules →DOMAIN-SUFFIX, GEOIP, and MATCH each serve a different purpose.
Check the destination, matched rule, and final policy together.
rules:
- DOMAIN-SUFFIX,github.com,Proxy
- DOMAIN-KEYWORD,google,Proxy
- IP-CIDR,127.0.0.0/8,DIRECT
- GEOIP,CN,DIRECT
- MATCH,Proxy
Proxy must be the name of a proxy or proxy group defined in the configuration.
DOMAIN-SUFFIX,github.com,Proxy
Routed through the Proxy policy
Subdomains meet the suffix condition. Once matched, the trailing MATCH rule is not checked.