Shadowrocket REJECT Rules: What They Block and What They Don’t

REJECT rules deny requests by domain or IP. This guide explains what they can block and what they can’t, including same-host content and content embedded in apps. REJECT is not a universal ad blocker.

At a glance

This guide is for anyone adding blocking rules or troubleshooting rules that don’t work or block too much. First check whether the target uses a dedicated hostname, then test with the narrowest rule possible. If unwanted content shares a hostname with features you need—or triggers no new request—don’t keep widening the block.

What REJECT does: denies matching connections

On iPhone or iPad, connect Shadowrocket from Home, then check that Home → Global Routing is set to Config and that the active profile on the Config page is the one you edited. Home handles the connection and routing selection; Config is where profiles are managed. Saving a profile doesn’t mean the active connection is using it.

App requestTunnel interceptionTarget identificationRule matchConnection denied

For a connection routed through the tunnel that matches REJECT, Shadowrocket denies the connection instead of sending it through a proxy or allowing it with DIRECT. “Deny” doesn’t mean removing an element from a webpage or changing content the server has already returned. After a connection fails, the app may leave a blank space, show a loading error, switch to a fallback host, or retry later. A blank area on the page alone doesn’t tell you which rule matched.

1 rule
Rules are evaluated from top to bottom; the first match applies
/32
Single-address prefix in an IPv4 rule
443
Default HTTPS port; page paths aren’t part of the match

What REJECT can block: dedicated hostnames and specific IP addresses

If a metrics request goes to metrics.example.com while sign-in, images, and content use different hostnames, start with an exact match for the metrics host. Use DOMAIN-SUFFIX only after confirming that the suffix and its subdomains are all within the intended scope. Don’t use the parent domain example.com instead of metrics.example.com: that would also match other hostnames beneath it.

Domain matching

Exact match
DOMAIN,metrics.example.com,REJECT
Suffix match
DOMAIN-SUFFIX,metrics.example.com,REJECT
Scope
The suffix rule also matches edge.metrics.example.com

Start with an exact match. The two lines are for comparison; you don’t need to add both.

IPv4 address matching

Single-address rule
IP-CIDR,192.0.2.24/32,REJECT
What the rule matches
The destination IPv4 address being matched
Not covered
Other IPv4 addresses and IPv6 addresses

The example uses a documentation-only address. Other services on the same address could also be blocked by mistake.

IP rules work well for checking a known, single-address target, but not for permanently blocking an entire address range based on one DNS lookup. A hostname may resolve to multiple addresses and can change its address across networks or over time. Conversely, multiple hostnames may share one address. Even if two hostnames resolve to the same IP, that doesn’t mean they serve the same content.

Testing order: start with a single hostname

If you know the target hostname, start with one DOMAIN rule and check that the features you need still work. Switch to DOMAIN-SUFFIX only if you’ve confirmed that multiple subdomains should also be denied.

What REJECT can’t block: URL paths, mixed responses, and local content

Here, “same host” means requests use the same hostname—not simply that two hosts share a parent domain. Suppose media.example.com/feed serves an article and media.example.com/promo serves promotional content, with both using the default HTTPS port, 443. The domain and IP rules discussed here don’t match URL paths, so denying the whole host may block the article too. Even when the two paths trigger separate requests, a single domain rule can’t distinguish between them.

Content sourceWhat the rule can distinguishExpected result
Different paths on the same hostCan match the host, but can’t distinguish paths by domain or IPDenying the host may also interrupt features you need
Article text and promotional fields in the same responseCan allow or deny the connection, but can’t filter individual fieldsAllowing the connection returns the full response; denying it also prevents the article from loading
Cached images and assets bundled with the appNothing new is requested from the network for the current displayThe asset may still appear after you add a rule
Content loaded from a fallback hostThe rule only denies the target it matchesContent may still load if the fallback host doesn’t match

The key question is where the asset comes from, not which page displays it. An in-app banner fetched in real time from a dedicated host may still be blocked by a domain rule. But if a webpage returns promotional content together with its main content, denying the domain can’t remove just the promotion. When testing, distinguish between an old asset that’s still displayed and one the app has fetched again from another host.

REJECT not working or blocking too much: check in order

  1. Keep a copy of the profile and note what happens. Write down the steps that reproduce the issue, such as opening a content page and refreshing it. Choose a feature to preserve—such as sign-in status or article loading—as a control. Keep the device, network, and starting page the same throughout testing.
  2. Check the connection, routing mode, and active profile. On Home, confirm that Shadowrocket is connected and Global Routing is set to Config, then verify which profile is active. Don’t confuse Direct in Global Routing with a DIRECT rule inside a profile.
  3. Check which rule matches first. Put a specific blocking rule before any broader rule that could match first, and before FINAL. If the profile already has a FINAL rule, keep the existing fallback behavior; don’t add another just for testing.
  4. Trigger a new request. After saving, reopen the test page or refresh its content. If the app is reusing an existing connection, close and reopen the app before testing again. If connection logs are available, check the destination hostname or address and the matched policy. Don’t treat content already displayed on an old page as the result of a new request.
  5. Revert one change to check for unintended blocking. If sign-in, playback, or image loading fails after you add a block, remove that rule and repeat the same test. If the feature works again, narrow the rule’s match scope. Don’t change DNS, routing mode, or other rules at the same time.

The example deliberately puts an allow rule for the parent domain first. A request to metrics.example.com matches DOMAIN-SUFFIX before it reaches the REJECT rule below, so the block won’t take effect. To test an exact match, move the second line above the first. Leave the rest of the existing profile unchanged.

DOMAIN-SUFFIX,example.com,DIRECT
DOMAIN,metrics.example.com,REJECT
FINAL,DIRECT
Download Shadowrocket