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.
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.
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 condition | Possible outcome | What to check |
|---|---|---|
| Exact DOMAIN exception before the suffix rule | The specified host uses the exception policy first | Confirm the exception is needed and covers only the hosts that must remain accessible |
| Broad DOMAIN-SUFFIX rule before an exact-match rule | The later exact rule cannot match a request already caught by the earlier rule | Change the rule order instead of adding the same rule again |
| An earlier IP-CIDR or GEOIP rule matches | The request may be handled by an IP-based condition first | Check the destination details and matched rule in the connection log |
| FINAL appears before the new rule | The request has already matched the fallback, so later rules cannot take effect as intended | Place 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.
- 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.
- 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.
- Add the smallest rule needed. Add a rule in the form
DOMAIN,metrics.example.com,REJECTto the current configuration's[Rule]section, replacing the example domain with the destination you verified. Place it before relevant broad matches and FINAL. - Check the test setup. Save the configuration, then confirm the active configuration and
Global Routing → Configin Home. Check the connection status as well. If the connection is unstable, troubleshoot the connection first and test the rule afterward. - 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.
- 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.
- Rules cannot distinguish paths on the same domain.
example.com/newsandexample.com/banneruse the same domain. This rule cannot reject one based only on the path that follows it. - Cached in-app content is not deleted. Old images or local cache may still appear. Seeing content on the page does not prove that a new request bypassed the rule; check whether a connection was actually made.
- Existing long-lived connections may not be re-evaluated immediately. A connection that was already established may continue after you save the rule. Start a new connection and check the result rather than waiting for the current page to change on its own.
- A direct IP connection may not provide a domain to match. If the only destination visible to the client is an IP address, do not assume DOMAIN-SUFFIX will match. Check the destination details in the log first.
- Traffic that does not enter the current tunnel is not evaluated by this rule. A disconnected tunnel, system routing, and other bypass conditions must be checked separately from the rule itself.
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.