Rule entry point: the active configuration’s rules:
First, check the active configuration on the client’s “Profiles” or “Subscriptions” page, then select “Rule” mode on the “Proxies” page. Menu names vary by client, so follow the labels in your interface. Global mode routes traffic through the global policy group, while Direct mode allows it through directly. In either mode, changing entries under rules: will not affect routing.
Open the configuration YAML and find the root-level rules: key. Each list item beginning with - is a rule. The common format is type,match value,policy; some IP rules also accept no-resolve at the end. MATCH needs no match value; use MATCH,policy. If rules: already exists, add entries to that list rather than creating another top-level key with the same name. Use spaces for indentation and standard commas.
For the policy, use the built-in DIRECT or REJECT, or an existing policy group in the active configuration, such as Proxy Selection under proxy-groups:. Enter the group name exactly as configured, including capitalization and spaces. PROXY is not a universal built-in policy; reference it only if an outbound or group with that exact name exists in your configuration.
Rule types: exact domains, domain suffixes, and IP ranges
| Type | Syntax | What it matches |
|---|---|---|
DOMAIN |
DOMAIN,api.example.test,DIRECT |
Matches only api.example.test, not its subdomains |
DOMAIN-SUFFIX |
DOMAIN-SUFFIX,example.test,DIRECT |
Matches example.test and all of its subdomains |
IP-CIDR |
IP-CIDR,192.0.2.0/24,DIRECT,no-resolve |
Matches destination IPv4 addresses from 192.0.2.0 through 192.0.2.255 |
IP-CIDR6 |
IP-CIDR6,2001:db8::/32,DIRECT,no-resolve |
Matches destination addresses within the specified IPv6 prefix |
GEOIP |
GEOIP,CN,DIRECT |
Matches destination IPs classified as CN in the current GeoIP data |
MATCH |
MATCH,DIRECT |
Catches connections that did not match any preceding rule |
Do not include a protocol, path, or wildcard in the domain field
To create a rule from https://api.example.test:8443/v1, use only api.example.test. Port 8443 and path /v1 are not part of the hostname; putting the full URL in DOMAIN will not route traffic by endpoint. Do not add *. to suffix rules either. Suffix matching respects domain-label boundaries, so example.test matches img.example.test but not notexample.test.
IP range rules match destination addresses, not the client’s address
IP-CIDR,192.0.2.25/32,DIRECT matches only that single IPv4 destination. Change the prefix to 192.0.2.0/24 to cover the entire example address block. Use /128 for a single IPv6 address. GEOIP also checks the destination IP, using data loaded by the core—not the website’s language, top-level domain, or the client’s location. Sites on shared CDNs may resolve to addresses in different regions; for a consistent route to a specific site, prefer a domain rule.
Rule order: put specific exceptions first and broad rules last
In Rule mode, the core checks the active rule list from top to bottom and stops at the first match. Rule types have no built-in priority: a DOMAIN rule placed after a matching DOMAIN-SUFFIX rule will not take precedence just because it is more specific. Similarly, place a /32 exception before a /24 rule that contains it.
rules:
- DOMAIN,telemetry.example.test,REJECT
- DOMAIN-SUFFIX,example.test,DIRECT
- IP-CIDR,192.0.2.25/32,REJECT,no-resolve
- IP-CIDR,192.0.2.0/24,DIRECT,no-resolve
- GEOIP,CN,DIRECT
- MATCH,DIRECT
- Connections to the hostname
telemetry.example.testmatch the exact rule first and are routed toREJECT. Swap the first two rules, and the suffix rule matches first instead, routing the same hostname toDIRECT. - A direct connection to
192.0.2.25matches the/32exception. A direct connection to192.0.2.26skips that exception and matches the/24rule. A narrower range does not automatically take priority. - Other connections continue to
GEOIPandMATCH. Both useDIRECThere to illustrate rule order. If your current configuration uses a proxy group as its fallback, keep that policy instead of copying this example.
DNS and no-resolve: when IP matching applies
If a connection reaches the core with its hostname, domain rules can match it directly. When an IP rule is evaluated, the core may need to resolve the hostname to determine whether the destination falls within a network range or GeoIP region. Place explicit domain rules before IP rules that require resolution. This lets known sites match first and avoids unnecessary DNS lookups for rule matching.
no-resolve prevents this rule from triggering a DNS lookup. The rule can still check a destination IP already present on the connection or an address resolved by an earlier rule. It does not disable DNS for the whole client or guarantee that no resolution is needed when forwarding the connection. If you want connections identified only by hostname to match an IP range based on their resolved address, do not add no-resolve by default.
Conversely, if an application provides only the destination IP to the core, domain rules cannot automatically recover the original hostname through a reverse lookup. With fake-ip, the core can use an existing mapping to recover the domain; whether that mapping is available depends on whether the DNS request was handled by the core. TUN is a way to capture traffic, not a separate rule-priority system. If results change after switching to TUN, first check whether the connection reaches the core and whether its details show a hostname, then decide whether the rules need adjustment.
Troubleshooting subscription updates and rules that don’t take effect
- Confirm the configuration is loaded. Save your changes, then reapply the active configuration. Check the client’s “Logs” page for YAML parsing errors or messages about missing policy names. Verify the indentation under
rules:, use standard commas, and check the names of referenced groups. Seeing a saved file in the interface does not mean the core has switched to the new configuration. - Test with a new connection. In Rule mode, visit the destination and open the “Connections” page to inspect the new entry’s hostname, destination address, matched rule, and outbound chain; field names vary by client. Browsers may reuse existing connections, so refreshing a page may not create a new entry. If needed, close the connection or restart the app and try again. If no new connection appears, first check whether the app uses the system proxy or is captured by TUN.
- Distinguish rule matching from policy group selection. If a rule points to “Proxy Selection” but the outbound chain shows
DIRECT, check which member the group currently selects instead of changing the rule order. If an earlier rule matched, inspect the active list and move the exception above that rule. - Check the final list after updates. Refreshing a remote subscription may overwrite manual changes. If the client supports overrides or merging, put exceptions in its supported prepend-rules section and preserve the subscription’s existing fallback. Rules appended after the existing
MATCHwill never run. If overrides are unavailable, you can maintain a local copy of the configuration, but subscription updates will not sync to that copy automatically.
After each change, test at least two new connections: one that should match the new exception and one that should keep using the existing policy. This confirms the exception works and helps catch overly broad suffixes or IP ranges that could change the route for unrelated connections.