Are you an LLM? You can read better optimized documentation at /en\tutorial\rules.md for this page in Markdown format
Routing Rules
Rules are evaluated from top to bottom. The first match selects an outbound policy. Put specific rules before broad ones and end with MATCH.
yaml
rules:
- DOMAIN-SUFFIX,example.com,Proxy
- GEOIP,CN,DIRECT
- MATCH,ProxyPolicies
The last field is a proxy node or policy group name, DIRECT, or REJECT. Some IP rules support no-resolve to avoid resolving a domain solely for that rule.
Rule types
| Type | Matches |
|---|---|
DOMAIN | Exact domain |
DOMAIN-SUFFIX | Domain and subdomains |
DOMAIN-KEYWORD | Keyword within a domain |
GEOIP | IP geolocation |
IP-CIDR, IP-CIDR6 | IPv4 or IPv6 network |
SRC-IP-CIDR | Client IP network |
SRC-PORT, DST-PORT | Source or destination port |
PROCESS-NAME, PROCESS-PATH | Originating process |
IPSET | Linux IP set |
RULE-SET | External ruleset |
SCRIPT | Script result |
MATCH | All remaining traffic |
Ruleset and script support depends on the Mihomo version and configuration.
