Rule syntax: type, match value, and outbound policy

In Clash Verge Rev, the interface manages Profiles and overrides, while the Mihomo core (formerly Clash.Meta) handles traffic. In Rule mode, the core checks the final configuration's rules in order for traffic it has taken over. Rules determine which outbound a connection uses, but they can't automatically proxy app traffic that never reaches the core.

A typical rule uses comma-separated fields: type,match value,policy. For example, DOMAIN,api.example.com,DIRECT sends the connection direct when its destination hostname is exactly api.example.com. DIRECT and REJECT are built-in policies for allowing a direct connection and rejecting it, respectively. You can also specify a proxy group in the active configuration. If that group is set to DIRECT, the connection will still go direct when the rule matches.

Domain rules: exact hosts, suffixes, and keywords

Type Syntax What it matches
DOMAIN DOMAIN,api.example.com,DIRECT Matches only api.example.com, not its subdomains.
DOMAIN-SUFFIX DOMAIN-SUFFIX,example.com,DIRECT Matches example.com and api.example.com, but not notexample.com.
DOMAIN-KEYWORD DOMAIN-KEYWORD,telemetry,REJECT Matches connections whose domain contains telemetry, including across unrelated domains.

Use DOMAIN to make an exception for a specific API host. Use DOMAIN-SUFFIX to apply the same policy to a root domain and all its subdomains. For suffix rules, enter example.com—not *.example.com. Keyword rules don't respect domain-label boundaries, so status-telemetry.example.net would also match. When you know the full hostname, prefer an exact rule to avoid affecting unrelated services.

Enter only the domain as the match value—no https://, port, or path such as /api/v1. These three rule types match against the destination domain known to the core. If an app connects directly to a destination IP and the core can't identify a domain from connection metadata, a domain mapping, or sniffing, the domain rule won't match. Check the connection details first, then decide whether to add an IP rule.

IP rules: IP-CIDR, GEOIP, and no-resolve

Match destination addresses by subnet

IP-CIDR,192.0.2.0/24,DIRECT,no-resolve matches connections to addresses from 192.0.2.0 through 192.0.2.255. To match only 192.0.2.25, use 192.0.2.25/32, not the entire /24. For IPv6, use IP-CIDR6,2001:db8::/32,DIRECT,no-resolve; a single IPv6 address uses /128. These are documentation example ranges. Replace them with the actual destination subnets after verifying them.

Match destination IPs by geographic data

GEOIP,CN,DIRECT checks the geographic database used by the core to determine whether the destination IP is classified as CN. It doesn't check whether a domain ends in .cn or indicate where the service itself is based. A CDN may resolve the same hostname to addresses in different regions. To ensure a service always uses a specific policy, put its domain rule before GEOIP.

Control whether rule matching triggers DNS

When the destination is a domain with no target IP available for matching, an IP-based rule without no-resolve may trigger a DNS lookup. Add no-resolve to the end of rules such as IP-CIDR or GEOIP to prevent that rule from initiating a lookup for matching. The rule can still match if the destination is already an IP or a usable target IP has already been obtained. This doesn't disable client DNS, stop later rules from resolving domains, or eliminate resolution needed for the connection itself.

Rule priority: the first matching rule wins

The core checks rules from top to bottom. It doesn't automatically put DOMAIN before DOMAIN-SUFFIX or prefer a longer CIDR prefix. To make an exception for a specific host while applying a different policy to the broader domain, put the exception before the rule with the wider scope:

rules:
  - DOMAIN,api.example.com,DIRECT
  - DOMAIN-SUFFIX,example.com,REJECT
  - MATCH,DIRECT
  • api.example.com matches the first rule and goes direct.
  • static.example.com skips the first rule, matches the second, and is rejected.
  • example.net matches neither of the first two rules, so the third rule catches it and sends it direct.

If you swap the first two rules, api.example.com will match the suffix rule first, and the exact-match rule won't be checked. Subscription RULE-SET entries also match according to their position in the final list. When troubleshooting, look beyond rules with the same name: check whether an earlier suffix, rule set, or IP range could match the same request.

prepend-rules: Add custom rules before subscription rules

Refreshing a remote subscription may overwrite its original configuration. To keep local exceptions, add prepend-rules in Clash Verge Rev's Merge override. This key is used by Verge Rev to process overrides; it isn't a native Mihomo rule field. When editing a local Mihomo configuration directly, use rules.

  1. On the Subscriptions page, confirm which Profile is selected. To share rules across multiple subscriptions, edit the Global Extension Config (Merge). To affect just one configuration, use the current Profile-specific override option available in your client version, rather than changing the global layer.
  2. Add the entries below at the root level of the Merge configuration, alongside the other top-level keys. If prepend-rules already exists, add the new entries to its list instead of declaring the key again. Prepend only the exceptions; don't add another MATCH, which could cut off the subscription's existing rules.
  3. Save and confirm that the configuration has been applied. On the Rules page, check the active list: custom entries should appear before the original subscription rules. If you also use Script or other overrides, the final loaded list takes precedence. A script that rebuilds rules may change the order or remove the entries you just added.
prepend-rules:
  - DOMAIN,api.example.com,DIRECT
  - DOMAIN-SUFFIX,example.com,REJECT

This example changes how two domain scopes are handled; all other connections continue to match the subscription rules. If the subscription already ends with MATCH, rules added after it won't take effect. After testing, remove only the new entries from the Merge layer and reapply the configuration to roll back—there's no need to reimport the subscription.

Rules not working? Check the mode, traffic capture, and match logs

  1. Check the outbound mode. Make sure the client is in Rule mode, not Global or Direct. Global and Direct modes don't use the custom rule list for normal traffic routing.
  2. Make sure the request reaches the core. Browsers usually connect through the system proxy, but some apps ignore it. To capture that traffic, check that TUN mode is enabled and the app's traffic is routed through TUN. Alternatively, configure apps that support an explicit HTTP proxy to use the local mixed port. For example, if the interface shows port 7897, enter 127.0.0.1:7897. Always use the port shown under Settings.
  3. Check a new connection. After changing rules, close existing connections and make a fresh request so the browser doesn't reuse an open connection. Find the destination on the Connections page and check its hostname or destination IP, matched rule, and outbound chain. Rejected requests may disappear from the connection list quickly; check the Logs page for details about how the request was handled.
  4. Check rule order and data differences. If a broader suffix or rule set matches first, move the exception above it. If a domain rule never matches, first check whether the core sees a domain or an IP. If behavior differs across networks, verify the actual destination IP and the GEOIP data—don't rely only on the address bar.

Test at least two types of requests: one that should match the new rule, and another that should keep following the subscription's existing behavior. Use match logs and the outbound chain to verify the result, not just whether the page loads. This confirms that the prepended rule works and helps catch a faulty fallback or an overly broad match that changes traffic routing.