At a Glance

If you already have a working configuration and want to reject connections to a domain, go to Home → Global Routing and select Config. Then start with a narrowly scoped DOMAIN or DOMAIN-SUFFIX rule. This guide explains where to add rules, which connections they match, and how to compare the same address before and after to tell an unmatched rule from an unreachable service.

When REJECT Takes Effect

REJECT is an action, not a match condition. In DOMAIN-SUFFIX,media.example.com,REJECT, the first field sets the match type, the second specifies the domain scope, and the third rejects connections that match. Rules only apply to connections routed through Shadowrocket that meet the condition in the active configuration. They do not remove image slots, ad containers, or placeholder text from a page.

App initiates a connectionTraffic enters the tunnelDomain condition is checkedFirst matching ruleREJECT action is applied

When checking your setup, distinguish between the two places labeled Config: Home → Global Routing → Config selects rule-based traffic handling, while the bottom Config tab lets you check which configuration is in use. Saving a copy of a configuration does not make it active. If Global Routing is set to Proxy or Direct, switch it back to Config before checking whether a rule takes effect.

3 fields
The basic fields in a domain rule: type, match value, and action
443
HTTPS default port; not part of the domain match value
2 fields
FINAL,DIRECT specifies only the rule type and fallback action

How to Decide: Can You Reject the Domain on Its Own?

If the page you want to keep and the resource you want to reject share a hostname and differ only by URL path, do not add a domain-level REJECT rule for that hostname. First check whether the resource comes from a different hostname that can be matched separately.

How to Write DOMAIN-SUFFIX and DOMAIN-KEYWORD Rules

For a known, complete hostname, use DOMAIN to keep the match narrow. Use DOMAIN-SUFFIX when you want to cover a domain and all of its subdomains. DOMAIN-KEYWORD looks for a string anywhere in the hostname; it does not require the string to align with a domain label. The shorter the keyword, the more likely unrelated domains will match. Enter only the hostname or keyword as the rule value—do not include https://, a port, path, or query parameters.

Match by hostname or domain suffix

Exact match
DOMAIN,media.example.com,REJECT
Suffix match
DOMAIN-SUFFIX,media.example.com,REJECT
Both match
media.example.com
Suffix only matches
img.media.example.com
Neither matches
othermedia.example.com

A suffix rule covers the domain itself and its subdomains; it does not match any hostname that merely ends with the same string.

Match a string anywhere in the hostname

Keyword rule
DOMAIN-KEYWORD,metrics,REJECT
Match example
metrics.example.com
Possible false positive
biometrics.example.net
Does not match paths
The hostname in www.example.com/metrics is www.example.com

If you can list the complete hostnames, use one DOMAIN rule per hostname to make unintended matches easier to spot.

For example, the hostname in https://media.example.com:443/assets/banner.png?size=2 is media.example.com. You do not need to include :443, and the rule cannot match banner.png on its own. If both connections resolve to the same hostname, this kind of rule cannot distinguish an image request from other requests to that host.

Rule Order, Allow Exceptions, and FINAL

In the configuration's [Rule] section, rules are checked from top to bottom. Put narrow exceptions first, broader reject rules after them, and keep the fallback at the end. If a rule covering an entire domain comes first, a more specific rule below it cannot override the action already selected.

[Rule]
DOMAIN,login.example.com,DIRECT
DOMAIN-SUFFIX,example.com,REJECT
FINAL,DIRECT

This minimal snippet illustrates rule priority; it is not a complete configuration you can drop in as-is. If your configuration already has a [Rule] section, add the new rules there instead of creating another section with the same name. Put the reject rule before any broader rule that might match the target first, and keep existing exceptions and the FINAL action. DIRECT is used here only as an example; it does not mean all other traffic should be routed directly.

Verify the New Rule with a Before-and-After Test

First confirm that the address is reachable, then check whether the new rule changes the outcome for a fresh connection. The example domains illustrate matching behavior; they are not live test endpoints. For an actual test, choose a test hostname you control and a second, equally reachable hostname that does not match the rule.

  1. In Config, check which configuration is active and keep a copy. Under Home → Global Routing, select Config and turn on the connection. Before adding the rule, visit both the target and comparison addresses and confirm they load. If the target already fails, troubleshoot connectivity first.
  2. Add just one DOMAIN rule for the target hostname, with the action set to REJECT. After saving, confirm the edited configuration is active and leave other rules and the fallback action unchanged.
  3. Start new connections and visit both addresses again. Avoid reusing an already open page, cached content, or an existing connection; if needed, close and reopen the test app. Refreshing a page alone does not guarantee a new connection.
  4. If the target becomes unreachable while the comparison address still works, remove the temporary rule and test the target again with a new connection. The target becoming reachable again is stronger evidence that the rule caused the failure than a single browser error. If both addresses fail, you cannot conclude that the target matched the rule.

Troubleshooting Unmatched Rules and False Positives

Why does the page still show the same content after I add a rule?

First make sure you are seeing freshly loaded content, not cached data or an interface already rendered by the app. Then check the hostname actually serving the resource: the page URL may differ from the address used for images, videos, or API requests. If the app switches to another hostname to fetch resources after a failure, the original rule will not automatically cover that fallback domain.

Can a domain rule match if an app connects directly to an IP address?

Without domain information to match against, DOMAIN-SUFFIX and DOMAIN-KEYWORD cannot match by domain. First determine whether the target is accessed by domain name and then resolved to an IP, or whether the app uses an IP address from the start. Do not broaden the rule to IP-CIDR based on a single DNS lookup; one IP address may host multiple sites.

Why did adding a reject rule break login and images too?

Remove the new rule first and confirm those features work again. Then check whether the login and image hostnames also match the same suffix or keyword. If the target resource has its own hostname, use an exact DOMAIN rule. If you need to allow a separate login hostname, put that exception before the broader reject rule. Domain rules cannot separate paths that share a hostname.

Does a successful Connectivity Test prove that REJECT is working?

No. Connectivity Test under Home checks whether a connection is available; it cannot show which rule matched a specific target. To check a single REJECT rule, test the actual target in Config mode before adding the rule, after adding it, and again after removing it.