Shadowrocket Rules for Specific Sites: How to Proxy Only Selected Domains

In Global Routing, select Config, add the target domains under [Rule], and use FINAL,DIRECT for connections that match no earlier rule. When finished, test a target domain and a control domain to confirm proxy and direct routing.

At a glance

This guide is for Shadowrocket users who have already added a working node and want to proxy only specific sites. Start by limiting the proxy scope with domain suffix rules, then check whether existing rules widen that scope. Finally, review the connection log to confirm the policy and distinguish a rule mismatch from a node connection failure.

Rule setup: send selected domains through PROXY and everything else through DIRECT

Here, “allowlist” means a list of domains permitted to use the proxy; it does not control website access. Connections matching the list use PROXY; everything else uses DIRECT, without going through a proxy node. Rules match the destination used by a connection, not the full URL in the browser’s address bar. Don’t include https://, a port, or a path such as /login in a domain rule.

[Rule]
DOMAIN-SUFFIX,example.com,PROXY
DOMAIN-KEYWORD,example.net,PROXY
FINAL,DIRECT

The example domains illustrate the syntax. Replace them with the domains you want to match. If you only need to proxy a fixed suffix, keep the relevant DOMAIN-SUFFIX rule; there’s no need to add DOMAIN-KEYWORD as well. If the file already contains [Rule], edit the rules in that section rather than adding a second section with the same name. Keep an original copy before editing the full configuration.

2 types
Example domain matching: suffixes and keywords
3 fields
Domain rule: type, match value, policy
1 rule
Final fallback: FINAL,DIRECT

Match scope: exact domains, domain suffixes, and keywords

A site’s homepage, login service, and static assets may use different hostnames. If only one host needs the proxy, use an exact domain rule. Use a suffix rule only when you need to cover the domain and its subdomains. A domain keyword matches the specified string anywhere in a hostname, so it should not be treated as a suffix rule.

Rule examplesMatchesDoes not match
DOMAIN,login.example.com,PROXYlogin.example.comwww.example.com
DOMAIN-SUFFIX,example.com,PROXYexample.com、login.example.comexample.com.example.org
DOMAIN-KEYWORD,example.net,PROXYexample.net、example.net.example.orgexample.org

To keep a direct-connection exception under the same suffix, place the more specific DOMAIN,static.example.com,DIRECT above DOMAIN-SUFFIX,example.com,PROXY. If you reverse the order, the suffix rule matches first, so the direct exception won’t take effect.

Edit and enable rules in Config

The steps below use the iPhone / iPad interface. The Config file and Config under Home → Global Routing are separate settings: the first selects the file to use, while the second determines whether traffic is routed by that file’s rules. Saving a file without switching the routing mode won’t verify the allowlist.

  1. Keep an original copy

    Open Config at the bottom and check which configuration is currently in use. Make a backup, then edit a local copy. If the original file is updated from a remote URL, changes made directly to it may be overwritten the next time it updates.

  2. Edit the rules

    Go to Config → target config ⓘ → Edit Config → Rule and add the domain rules. If the config menu includes Edit Plain Text, you can also use that text editor to review the full order of [Rule].

  3. Check the rule order

    Place exact exceptions above broader suffix or keyword rules. Check existing GEOIP and IP-CIDR rules, as well as rule-set references. Then replace the old fallback with FINAL,DIRECT; don’t append new rules after an existing FINAL.

  4. Enable the configuration

    After saving, return to the Config list and select the file you edited to make it the active configuration. Go to Home → Global Routing → Config, confirm that a working node is available, then turn on the connection switch on Home.

  5. Test each case

    On the same network, make a new request to the target domain and to a control domain that isn’t on the list. In the connection log, check the actual hostname and policy: the target should match a domain rule and use PROXY; the control should fall through to FINAL,DIRECT.

Global Routing: why choose Config?

Existing connections may keep using their original route after you switch routing modes. For a valid comparison, start a new request each time you change modes; if needed, close and reopen the relevant app. Remember to switch back to Config when you’re done. A single page refresh doesn’t show whether the full rule set is working.

Config

Recommended

Routes traffic according to the active configuration’s rules. Listed domains use PROXY; connections that match no earlier rule are handled by FINAL,DIRECT.

Use this when: You want to proxy only selected sites and verify exactly which rules match.

Proxy

Sends traffic handled by the client through the proxy without applying the allowlist rules in this guide. If the target site opens in this mode, that doesn’t mean it matched the right rule in Config.

Use this when: You need a quick check that the current proxy node can reach the target.

Direct

Sends traffic handled by the client directly. Unlike FINAL,DIRECT, this mode applies to all such traffic, not just connections that match no earlier rule.

Use this when: You want to compare the direct-connection result on the same network.

Scene

Uses the routing method configured for each scene. Select Config directly while testing rules to prevent scene changes from affecting the test.

Use this when: You’ve configured routing requirements for different network environments.

Troubleshooting an allowlist that isn’t working: check the hostname, then the policy

A page loading doesn’t prove it used the proxy, and a page failing to load doesn’t prove the rule was missed. During testing, note the actual hostname, matched rule, and final policy. If an action fails only after the homepage loads, retry the login, playback, or asset request separately and identify the hostname for the failed request. If the connection log already shows PROXY, check node connectivity or the destination service rather than widening the match scope.

I added the main domain. Why does the homepage load but login fail?

Retry the login and check the hostname after any redirects. If the login service uses a different domain and needs the proxy, add a DOMAIN rule for that host and try again. If it already matches PROXY, check the selected node on Home first; don’t add a broad login keyword rule.

I added FINAL,DIRECT. Why is other traffic still using the proxy?

Open Home → Global Routing and confirm that Config is selected. Then check which file is active under Config. If it’s the right file, use the connection log to find the earlier PROXY rule that matched, narrow its scope, and test again.

Why does the log show only an IP address, with no domain rule match?

Domain rules need a hostname to match. Make a new request using the domain name rather than testing by entering an IP address directly. If the app connects only to a fixed IP and you’ve confirmed that the address is dedicated to the target, consider an exact IP-CIDR match; for a single IPv4 address, use /32. Avoid this for shared or frequently changing addresses.

Nothing seems to change after saving. Should I reinstall?

Return to Config and confirm that you edited the active file. Then close the existing tab or quit any app that’s keeping a connection open, and make a new request. If a remote config update restores the original rules, test with a local copy and make sure the active configuration hasn’t switched back to the remote file.

Do I need to rewrite domain rules after changing nodes?

If the rules still route to PROXY, you don’t need to change the domain match conditions. Select another existing node on Home and test the same target domain again. If you need to update a subscription, get it from your service provider. Updating the node list and editing [Rule] are separate operations.

Shadowrocket download and setup guide

Get the iPhone / iPad version from the App Store for a one-time $2.99 purchase. Check the App Store listing for system requirements. The Mac (Apple Silicon / Intel), Windows, Android, and Linux versions are free; download their installers from this site’s download guide.

Download Shadowrocket