At a glance

If you already have a working Shadowrocket configuration, first decide whether to reject an entire domain or a specific URL path on that domain. For the former, set REJECT in [Rule]; for the latter, use [URL Rewrite] to match the full visible URL. To test, send one request to the target and one to a control, then check which rules matched. This helps distinguish a working rule from an inactive configuration or an unintended block. The steps below use the iPhone / iPad interface.

Where REJECT Fits in Rule Matching

REJECT is an action applied after a rule matches, not a matching condition. In DOMAIN-SUFFIX,telemetry.example.com,REJECT, the first field specifies the rule type, the second the match scope, and the third the action to reject the connection. A request can match this rule only if it falls within Shadowrocket's scope and provides the information required by the matching condition.

App requestTraffic interceptionTarget identificationRule matchingAction applied

In Config, confirm which configuration is active and save a copy before editing. Return to Home, make sure the connection is on, and select Config under Global Routing. An enabled connection does not necessarily mean traffic is being routed according to your configuration: Proxy and Direct are not suitable baselines for testing rules, and with Scene, the active behavior also depends on the scene settings. For troubleshooting, select Config first and avoid changing networks or modes at the same time.

3 fields
Example domain rule: type, match value, action
80
Default HTTP port
443
Default HTTPS port; the port itself does not include a URL path

DOMAIN-SUFFIX syntax: reject a domain and its subdomains

If a host is dedicated to requests you want to block, you can reject it by domain without inspecting the request path. DOMAIN-SUFFIX,telemetry.example.com,REJECT matches telemetry.example.com and subdomains such as v2.telemetry.example.com, but does not match api.example.com. To match only one exact hostname, use DOMAIN. Don't broaden the rule to example.com without a reason, or it may also block sign-in, images, and API requests on that domain.

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

This is a standalone test snippet; replace the example domain with a target you can verify. When adding it to your active configuration, place only the new entry in the existing [Rule] section and keep the original FINAL. Don't change your everyday fallback to DIRECT just for testing. If a request matches multiple rules, the first matching entry determines the action. For example, if the broad rule DOMAIN-SUFFIX,example.com,PROXY comes first, a subdomain rejection rule placed after it won't handle requests that have already matched.

Reject a domain and its subdomains

Configuration section
[Rule]
Match condition
DOMAIN-SUFFIX,telemetry.example.com
Action when matched
REJECT
Rule placement
Before broader rules covering the same target

Use when you can reject the entire host and don't need to distinguish individual paths.

Keep an exception for one subdomain

Specific match
DOMAIN,health.telemetry.example.com
Exception action
DIRECT (use only when you have confirmed the connection should be direct)
Rule placement
Before the corresponding DOMAIN-SUFFIX rejection rule

Handle specific exceptions first, then broader domain suffixes. The exception should use the outbound action already required for that host.

URL Rewrite syntax: reject a specific path

A single host may serve sign-in, sync, and analytics requests. If you want to reject only /telemetry while keeping /account, don't reject the entire host in [Rule] and expect URL Rewrite to allow one path through. To test path blocking on its own, first make sure no configuration rejects the test host as a whole.

[URL Rewrite]
^https:\/\/api\.example\.com\/telemetry(?:[/?]|$) - reject

HTTPS paths and query parameters are encrypted. Being able to route by domain does not mean you can match by path. Shadowrocket can apply a path rule only if it can process and inspect the corresponding HTTP request; for HTTPS, this usually requires an applicable MITM configuration and a trusted certificate. Enable it only for test domains you are authorized to inspect, and limit the scope to that host. If an app refuses the certificate used for inspection, stop the test rather than expanding decryption to other domains.

Verify Rule Matches and Find Unintended Blocks

  1. Establish a baseline first. Before adding a rule, send a request to a controllable test service that you know is accessible, and record the actual domain, path, and expected result. If the baseline already times out, fails to resolve, or returns an error, fix that first. A failed page alone does not prove that REJECT matched.
  2. Change one rule at a time. After saving your changes, check that this configuration is still active, then confirm that Global Routing on Home is set to Config. For a domain test, use one target host and one host outside the target suffix. For a path test, use /telemetry and /telemetry-status on the same host to confirm that only the first is rejected.
  3. Make the app send a new request. Quit and reopen the app under test, or verify with a fresh request from your test service. Don't mistake a cached page or an existing connection for a new request. If connection logs are available, check the timestamp, destination, and matched action. For a path test, also verify that the app actually requested the expected URL rather than a redirected address.
  4. Revert and test again. If normal requests also fail, remove the entry you just added or restore your saved copy, then repeat both the target and control requests. If reverting restores access, narrow the domain scope or path expression. If access still doesn't return, check DNS, server status, and network connectivity.

What REJECT Can't Block: Common Questions

Why is the content still visible after adding REJECT?

First check whether reopening the page creates a new connection. If the content is already cached locally or included in the page's main response, there may be no separate request to block. Use an uncached request to verify the actual host. Don't reject the domain serving the entire page just to remove one page element.

Why do connection logs show only an IP address when my hostname rule is correct?

First check whether the app connects directly to an IP address. If Shadowrocket doesn't receive a matchable domain, DOMAIN-SUFFIX can't infer the hostname. Consider matching with IP-CIDR only if you have confirmed the address is fixed, its ownership is clear, and the rule won't affect other services. Avoid using a shared IP as a substitute for a domain rule.

Why isn't my path rule matching even though the path looks right?

Check the actual URL's hostname, port format, and any redirects, then confirm the protocol is within the inspection scope of the active configuration. If the path isn't visible in HTTPS traffic, changing the regular expression won't help. If the app's connection method can't be inspected as expected, use domain-level matching instead and accept that paths on the same host can't be distinguished.

Why does blocking work on one network but not another?

First check the connection status and Global Routing on Home for each network. Then check whether Settings → On Demand has different connection conditions for different networks. A rule cannot inspect traffic that isn't handled by Shadowrocket. Reproduce the issue on the same network with the same configuration before comparing results across networks.

REJECT applies to new requests handled by the app that meet the rule's conditions. It doesn't remove content already downloaded or act as device-level access control. State verifiable results as “the target request was rejected and the control request remained accessible under this configuration,” not “all similar content in this app or on this page has been blocked.”