In Shadowrocket, REJECT is a connection-handling policy, not a page-element filter. This guide is for users editing an existing Config. The steps refer to Home, Config, and Settings on iPhone and iPad; check the interface on other platforms. First, make sure Global Routing is set to Config. Start with a narrow rule for one domain, check the request log to confirm a match, then handle exceptions and fallback rules. This helps avoid blocking connections needed for sign-in, images, or payments.
1. What REJECT does: blocks connections, not page content
A rule consists of a matching condition and an action. In DOMAIN,ads.example.com,REJECT, DOMAIN is the match type, ads.example.com is the target, and REJECT is the action taken when it matches. The rule doesn’t search for text on a webpage or decide whether an image looks like an ad.
This flow assumes the request is handled by Shadowrocket and that the current routing mode applies Config rules. Once REJECT matches, the connection can’t retrieve the requested resource normally. You may see a blank area, a failed image, or a network error in the app. What happens depends on the app making the request; a page looking unchanged doesn’t prove the rule failed to match.
Rule handling and upstream protocols are separate. Whether an existing configuration uses Shadowsocks, VMess, VLESS, Trojan, Hysteria2, or WireGuard doesn’t change what the DOMAIN-SUFFIX rule matches. REJECT blocks the connection; it doesn’t tell Shadowrocket to retry through another proxy server.
2. Rule syntax: distinguish the match type from the action
These two configuration cards distinguish what a rule matches from what it does. They explain syntax; don’t add every example to your everyday configuration. All domains and IPs are illustrative. 192.0.2.0/24 is a documentation range, not a real target to block.
Domain matching
- Exact domain
DOMAIN,ads.example.com,REJECT- Domain suffix
DOMAIN-SUFFIX,example.com,REJECT- Matches
- The destination domain associated with a request, not the full URL.
Start with DOMAIN. Use DOMAIN-SUFFIX only after confirming that subdomains should also be covered.
IP matching and fallback
- IP range
IP-CIDR,192.0.2.0/24,REJECT- Geographic match
GEOIP,CN,DIRECT- Final rule
FINAL,DIRECT
GEOIP matches based on IP geolocation data. FINAL handles connections that didn’t match an earlier rule; neither checks content.
DOMAIN-SUFFIX,example.com,REJECT matches example.com and its subdomains, such as img.example.com and a.b.example.com. It doesn’t match any domain that merely contains the same text, so notexample.com isn’t covered. Enter only the domain—no https://, port, or path.
DOMAIN: Use for a confirmed, specific target, such asads.example.com.DOMAIN-SUFFIX: Use when you need to cover a domain and its subdomains. It usually matches a broader set than a single DOMAIN rule.IP-CIDR: Matches an IP address range. Multiple domains may share an IP, so one address doesn’t necessarily correspond to one website.GEOIP: Matches the geographic location associated with an IP. It doesn’t indicate where a domain is registered, the language of a webpage, or its content.FINAL: This rule has no specific target condition. Put it at the end of the rule section and keep a fallback action suited to your existing configuration.
3. Rule order: specific exceptions first, broader rules later
Configuration rules are generally checked from top to bottom. When a connection matches a rule, its action is applied. Adding a REJECT rule to a file doesn’t mean it will always run: an earlier, broader DIRECT rule, proxy policy, or rule set may already match the request. When troubleshooting, check both the rule and its position.
[Rule]
DOMAIN,login.example.com,DIRECT
DOMAIN-SUFFIX,example.com,REJECT
FINAL,DIRECT
This minimal example illustrates rule order; it isn’t a general-purpose connection configuration. The first line lets login.example.com connect directly. The second rejects example.com and its other subdomains. The final FINAL,DIRECT handles all remaining connections. If the exception is placed below the suffix rule, the login domain will match the suffix rule first.
Takeaway: confirm rule order before broadening the block
If you need to handle only one host, start with a DOMAIN rule and check the request log. Switch to DOMAIN-SUFFIX only after confirming that other subdomains should also be blocked, and keep necessary exceptions above it.
The fallback in an everyday configuration isn’t always DIRECT; it may use an existing proxy policy. Don’t replace your existing FINAL rule or add a second [Rule] section just to copy the example above. Edit the existing rule section and preserve its policy names and references.
4. Apply the change: back up your Config and verify it
These steps assume you already have a working configuration. REJECT doesn’t require adding a service source. This site doesn’t provide, sell, or recommend nodes or subscriptions. Check Subscribe updates and Config rule edits separately; updating a server list doesn’t mean your rules have been saved.
- Keep a rollback copy. Open Config, back up the current configuration, and note which file is in use. If it came from a remote URL you already use, save an editable copy so a later remote update won’t overwrite your local changes.
- Add the smallest rule needed. In the target configuration’s editor, find
[Rule]and add one DOMAIN rule for a confirmed target. Place it above any broader rule that could match first, and keep FINAL at the end. - Save and select the edited Config. After saving, make sure the selected file is the one you just edited, not another file with a similar name. If needed, reconnect so new requests use the saved configuration.
- Check Global Routing. Go back to Home and set Global Routing to Config. Proxy and Direct apply proxying or direct connections globally; they don’t verify this configuration rule. Scene also involves choosing a scene. For troubleshooting, select Config first to reduce variables.
- Trigger the target request again. Close and reopen the target page, then check the request log for the destination domain, matching rule, and final action. Change one rule at a time and note what differs before and after.
- Retest normal features. Check sign-in, image loading, and file downloads as well as the target page. If something is blocked unintentionally, remove the rule you just added and narrow its match.
Settings → On Demand controls when connections are established or disconnected; it doesn’t enable content matching for REJECT. If the connection drops automatically during testing, check the conditions there and the system VPN status. Changing On Demand and rule order repeatedly makes results harder to diagnose.
5. Limits: same-domain content, caching, and shared IPs
REJECT works best when the target is clearly defined and its requests can be distinguished by connection. For example, rejecting a dedicated domain used only for unwanted resources may stop those resources from loading. But blocking a connection doesn’t guarantee that the corresponding area disappears; the webpage or app controls its layout and placeholders.
| Request scenario | What REJECT can and can’t do | Recommended approach |
|---|---|---|
| A dedicated subdomain serves the resource | You can reject connections to that domain | Test with DOMAIN first; don’t immediately expand the rule to the parent domain |
| The page and other content share a domain | Domain rules can’t distinguish different paths on the same domain | Don’t block an entire service domain to target one URL |
| Multiple sites share a CDN address | IP-CIDR may affect unrelated sites too | Check the domain first; use IP range rules with care |
| The resource is cached locally | Displaying the page may not create a new connection to the target | Reload the page and check whether a new request appears |
| The resource is embedded in the main response or uses another domain | There may be no separate connection for the rule to match | Use the request log as evidence; don’t add duplicate rules to test a match |
For example, https://example.com/article and https://example.com/promo use the same destination domain. DOMAIN and DOMAIN-SUFFIX can’t distinguish them by path. For HTTPS, the request path isn’t a match parameter for these rules. Adding REJECT doesn’t require enabling HTTPS decryption.
Ports also don’t belong in the domain parameter: example.com:443 isn’t a valid domain value for these rules. HTTPS commonly uses TCP 443, and HTTP/3 commonly uses UDP 443, but using port 443 doesn’t identify a resource type or prove that a domain rule matched. Check the actual destination and action instead of inferring content from the port.
6. FAQ: why a rule has no effect—or blocks normal requests
I added REJECT. Why does the page still load?
On Home, first confirm that the connection is enabled, Global Routing is set to Config, and the edited file is selected in Config. Then check whether a new request matches the target rule. The main page may load from another domain or from cache; being able to open it doesn’t prove the rule failed.
Why did blocking a domain also break sign-in?
Disable the rule you just added and try signing in again to see if removing it resolves the problem. If you used DOMAIN-SUFFIX, check whether authentication, verification codes, and static resources share that suffix. Prefer narrowing the rule to a confirmed DOMAIN instead of adding more exceptions for the entire parent domain.
Why is the request still rejected after I added a DIRECT exception?
Check that the exception appears above the broader REJECT rule and that its domain exactly matches the one in the request log. A redirect may send the request to another host; allowing only the original page’s domain may not cover later requests. Don’t rely on the address bar to identify the match target.
Why didn’t updating Subscribe change my rules?
Subscribe updates usually refresh existing subscription content; they don’t show whether local rules in the active Config changed. Open Config and check which file is selected and what its rules contain. For a remote configuration, also check whether an update overwrote your local edits; restore your earlier backup if needed.
Is it easier to reject an entire IP range?
First check what the range covers. Shared hosting and CDNs can put multiple services on the same addresses, and IP-CIDR matches by address—not by website name. If you need to handle just one domain, start with DOMAIN and test sign-in, downloads, and other features before considering a broader match.
7. Checklist before keeping a rule
The goal of rule maintenance is to match the intended requests, not to keep adding REJECT lines. For a reliable test, hold the configuration, connection mode, and test action constant, and change one condition at a time. Don’t count a temporary network timeout as proof the rule worked, or a cached page as proof it failed.
- Confirm the target: Record the actual request domain or IP; don’t use the page title or product name as a substitute for the connection target.
- Explain the order: Know which rule the request matches first, put specific exceptions before broader rules, and keep FINAL last.
- Reproduce the result: Make the request again and confirm the corresponding action in the log instead of judging from a single page outcome.
- Retest key features: Check sign-in, verification codes, images, downloads, and other dependencies—not just whether the target resource disappeared.
- Keep changes reversible: Retain the original Config, record each added rule and why it was added, and check again after remote configuration updates.
To learn how configurations differ from subscriptions, read the subscription manual. For keywords such as DOMAIN-SUFFIX, GEOIP, and FINAL, see the glossary. A one-time app purchase is not a service plan; getting the app and managing services you already use are separate tasks.