Shadowrocket REJECT Rules: How Domain Blocking Works and Its Limits

Learn how REJECT works in rule matching, how to combine DOMAIN-SUFFIX with REJECT, which requests rules cannot block, and why false positives can break pages.

At a glance

This guide is for users who already use their own configuration in Shadowrocket and need to reject connections to specific domains. First, distinguish match conditions from the REJECT policy. Then use reserved example domains to explain rule order, exceptions, and verification. Finally, troubleshoot rules that have no effect and pages that behave unexpectedly. The examples contain no information about usable services and should not replace your existing configuration wholesale.

1. REJECT Is a Policy, Not a Match Condition

A rule typically describes what to match and then specifies what to do when there is a match. DOMAIN-SUFFIX matches a domain suffix; REJECT rejects the connection. Together, they mean that a matching domain will not use a proxy or direct-connection policy to establish that connection. They do not scan a page and remove individual elements.

Request enters the tunnel Destination details identified Rules checked in order Policy applied

To test the rules in this guide, use configuration-based routing in Home → Global Routing → Config, and confirm that the edited configuration is enabled. Routing behavior under Proxy, Direct, and Scene is not equivalent to the Config test conditions described here. Turning on the connection does not mean a particular rule file is being used for matching.

Settings → On Demand controls when the system connects or disconnects the VPN based on conditions; it does not change a domain's policy to REJECT. When troubleshooting, check separately whether the tunnel is connected, the configuration is enabled, and which rule matched the request. Do not treat automatic connection settings as a domain-blocking switch.

3 items
DOMAIN-SUFFIX example includes a keyword, domain, and policy
2 items
FINAL example includes a keyword and fallback policy
1 rule
With standard sequential matching, the first matching rule determines the policy

2. Correct DOMAIN and DOMAIN-SUFFIX Syntax

The examples below use reserved example domains to illustrate syntax only. Add rules to the configuration's [Rule] section. If the section already exists, edit it rather than creating a duplicate. The domain field must not include a scheme, path, port, or query string. Separate fields with English commas.

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

In this minimal example, account.example.com matches the exact exception first and uses DIRECT; example.com and img.example.com match the suffix rule and use REJECT. notexample.com is not a subdomain of that domain, even though its name ends with a similar string. The final line only illustrates the fallback position; it does not mean you should change your existing FINAL policy to DIRECT.

Exact-domain rule

Keyword
DOMAIN
Target
metrics.example.com
Policy
REJECT
Full rule
DOMAIN,metrics.example.com,REJECT

Matches only this domain; subdomains are not included.

Domain-suffix rule

Keyword
DOMAIN-SUFFIX
Target
metrics.example.com
Policy
REJECT
Full rule
DOMAIN-SUFFIX,metrics.example.com,REJECT

Matches this domain and its subdomains, but not similarly named domains.

If you only need to reject metrics.example.com, do not broaden the rule to all of example.com. A single parent domain may serve login, images, payment callbacks, and analytics requests. The broader the suffix, the greater the risk of false positives. Start by testing the target with DOMAIN, then decide whether the actual requests warrant DOMAIN-SUFFIX.

3. Rule Order: Specific Exceptions First, FINAL Last

With standard sequential matching, the first matching rule determines how a request is handled. A more specific rule later in the list does not automatically override a broader rule above it. Adding REJECT does not make blocking work simply because the line exists in the file; check that no earlier condition catches the request first.

Position or conditionPossible outcomeWhat to check
Exact DOMAIN exception before the suffix ruleThe specified host uses the exception policy firstConfirm the exception is needed and covers only the hosts that must remain accessible
Broad DOMAIN-SUFFIX rule before an exact-match ruleThe later exact rule cannot match a request already caught by the earlier ruleChange the rule order instead of adding the same rule again
An earlier IP-CIDR or GEOIP rule matchesThe request may be handled by an IP-based condition firstCheck the destination details and matched rule in the connection log
FINAL appears before the new ruleThe request has already matched the fallback, so later rules cannot take effect as intendedPlace rules that need to be evaluated before FINAL

Key takeaway: Find the first matching rule before changing the blocking scope

If the request log shows an earlier DIRECT or PROXY rule matched, fix the order first. Adding more suffix rules will not change a decision that has already been made.

GEOIP matches based on an IP address's geographic location, while IP-CIDR matches an address range. Neither identifies domain categories. Blocking an entire shared IP range to fix one domain rule may affect other sites hosted on the same infrastructure. Unless you have a clear need for address-based filtering, check the domain and rule order rather than broadening the IP range.

4. Steps to Add a Rule and Verify the Result

Change one condition at a time so you can link any page changes to the rule. These steps assume you already have your own configuration. If you need a proxy connection, continue using your own service configuration; this guide does not cover finding or recommending services.

  1. Keep a recoverable copy. In Config, confirm which configuration is in use, then save a copy or note the original contents. Take particular care to preserve existing policy names, DNS settings, and FINAL. Do not import this minimal example as a complete, ready-to-use configuration.
  2. Confirm the actual destination. Check the connection or request log for the destination domain of the failing request. Record the full hostname instead of guessing from the page title; the page itself, its images, and its API requests may use different hosts.
  3. Add the smallest rule needed. Add a rule in the form DOMAIN,metrics.example.com,REJECT to the current configuration's [Rule] section, replacing the example domain with the destination you verified. Place it before relevant broad matches and FINAL.
  4. Check the test setup. Save the configuration, then confirm the active configuration and Global Routing → Config in Home. Check the connection status as well. If the connection is unstable, troubleshoot the connection first and test the rule afterward.
  5. Make a new request. Reopen the page or quit and relaunch the target app to generate a new connection if possible. Check the destination, matched rule, and policy in the relevant log entry. Do not rely solely on whether a particular page element disappears.
  6. Revert one change at a time. Remove only the rule you just added, save, and repeat the same action. Check whether the feature works again. If the change had no effect, investigate other requests rather than deleting an entire group of rules.

HTTPS sites commonly use port 443, but DOMAIN,metrics.example.com,REJECT does not limit the match to port 443. This rule matches a domain, not a URL, request method, or port. Do not enter a full address containing :443 in the domain field.

5. Requests and Page Content Outside the Scope of Domain Rules

Domain rules apply to matchable connection destinations; they do not classify page content. The same domain can serve text, images, recommendations, and login APIs, and one connection may carry multiple requests. DOMAIN-SUFFIX alone cannot tell which part of the content should be allowed.

DNS lookup records are not the same as the final connection result. A domain may resolve successfully and the subsequent connection may still be rejected. Conversely, a failed lookup may prevent the connection from reaching the expected rule-checking stage. Track DNS resolution, rule matching, and connection results separately.

6. Troubleshooting Page Errors and Rules That Don't Take Effect

False positives can cause repeated login redirects, blank images, buttons that keep spinning, or verification flows that never finish. These symptoms may indicate a failed dependency request, but they do not prove by themselves that the request should be allowed. Compare the new rule with the actual match log and narrow the scope one rule at a time.

I added REJECT. Why does the page still open normally?

First confirm that the target actually requested the blocked domain, then check Home → Global Routing → Config and the active configuration. The page loading normally does not mean the rule failed; the blocked request may be for a supplementary resource. Check the match policy for a new connection.

Why did blocking an analytics domain also break login?

Check whether you used DOMAIN-SUFFIX for the entire parent domain by mistake. Remove the rule you just added and try logging in again. If login works, replace it with the verified exact DOMAIN. If a login host must remain accessible, add a specific exception before the broader rule and use the normal access policy from your existing configuration.

The log shows REJECT. Why do I still see DNS requests?

DNS resolution and connection handling are separate stages. A DNS record does not mean the app successfully reached the destination. Check whether the corresponding connection was rejected; do not broaden domain or IP blocking just to remove a DNS entry.

Why did my custom rule disappear after updating the configuration?

Check whether you updated a node subscription or the entire configuration file; they are different things. A remote configuration update may replace local edits. Compare a copy from before and after the update, check which file is active, and restore only the necessary rules you have verified.

If the issue persists after removing a single rule, continue checking the network, DNS, and server response instead of attributing every failure to REJECT. For basic connectivity checks, see the troubleshooting guide. If you're unsure how Config and Home differ, follow the getting started guide to confirm how to enable a configuration.

Verify on the App Store →