This guide is for users who have added their own connection configuration to Shadowrocket and want only a few websites to use a proxy. Go to Home → Global Routing → Config, then add domain rules in order under [Rule] in the active configuration. End with FINAL,DIRECT. Afterward, check the connection log for each target domain, matched rule, and selected policy—don’t rely solely on whether a page loads.
1. Make sure Global Routing is set to Config
An enabled connection and rule-based routing are two different things. The connection toggle determines whether the client handles the relevant traffic; Global Routing determines how that traffic is routed. To proxy selected sites and send everything else direct, choose Config under Home → Global Routing, then make sure the Config page has the file you intend to edit enabled.
This guide assumes you already have your own provider and subscription, and a working connection listed in Home. Rules determine where traffic goes; they don’t create connection credentials or fix a remote service that is no longer working. This site does not provide, sell, or recommend nodes or subscriptions.
| Mode | How it routes traffic | How this guide uses it |
|---|---|---|
| Config | Matches connections against rules in the active configuration | Use this to test routing for selected sites |
| Proxy | Routes connections through a global proxy | Not suitable for testing the results of FINAL,DIRECT |
| Direct | Routes connections directly | Not suitable for testing domain proxy rules |
| Scene | Routes traffic according to configured scenes | For troubleshooting, switch back to Config to avoid interference from scene changes |
2. The basic rule structure: domains first, FINAL last
This minimal [Rule] snippet illustrates the structure; it is not a complete configuration file. example.com and example.net are sample domains—replace them with the domains you actually want to route. When adding the snippet to an existing configuration, keep its connection details and other required settings. Don’t overwrite the entire file.
[Rule]
DOMAIN-SUFFIX,example.com,PROXY
DOMAIN,api.example.net,PROXY
FINAL,DIRECT
DOMAIN-SUFFIX,example.com,PROXY matches example.com itself, along with subdomains such as www.example.com and static.example.com. It is not a substring match, so a similar string elsewhere in a domain won’t trigger it. DOMAIN,api.example.net,PROXY matches only that exact hostname; it won’t match other subdomains of example.net.
The final line, FINAL,DIRECT, catches connections that didn’t match any earlier rule. This configuration means “use PROXY for the specified domains and DIRECT for everything else.” DIRECT still depends on the device’s network being available; it doesn’t guarantee a successful connection.
Bottom line: test one domain first
Start with a single DOMAIN-SUFFIX rule and verify that it matches before expanding the list. Add domains one at a time. If you make a large batch of changes at once, it’s harder to tell which rule changed the routing.
3. Choosing between DOMAIN-SUFFIX and DOMAIN-KEYWORD
For a few specific sites, use DOMAIN or DOMAIN-SUFFIX whenever possible. Consider DOMAIN-KEYWORD only when you need to match a group of domains containing a particular string and are comfortable with the broader scope. Rules match the hostname used by a connection—not the full URL or text on a page.
| Rule syntax | What it matches | When to use it |
|---|---|---|
DOMAIN,login.example.com,PROXY | Only login.example.com | Route a single login hostname differently |
DOMAIN-SUFFIX,example.com,PROXY | example.com and its subdomains | Services hosted under the same root domain |
DOMAIN-KEYWORD,example,PROXY | Domains with example in the hostname | When keyword matching is needed and the risk of unintended matches has been assessed |
For example, DOMAIN-KEYWORD,example,PROXY could also match example-unrelated.test. If you only want example.com, this rule is too broad. Use DOMAIN-SUFFIX instead of adding exception after exception to counteract an overly broad keyword rule.
- Set the match value to
example.com, nothttps://example.com. - Don’t include
/video, query parameters, or URL fragments. Standard domain rules can’t proxy only a specific path on a host. - For DOMAIN-SUFFIX, don’t write
*.example.com. Enter the domain suffix directly. - Don’t include
:443in a domain rule. HTTPS commonly uses port 443, but the match value here is still the hostname. - A page may load resources from separate login, image, or API domains. They may not share the root domain in the page’s URL.
4. Edit and enable the active configuration
Rules are generally evaluated from top to bottom, and the first matching rule determines the policy for that connection. Put specific exceptions before broader rules. To proxy only selected sites, also review any existing rules that send traffic through a proxy. Changing the last line to DIRECT won’t cancel those rules.
-
Save a copy
Open Config and save a copy of the current configuration or export the file. Note which configuration is enabled so you can switch back if your changes don’t work.
-
Check the policy
In Home, make sure a connection is available. Then check that PROXY or your custom policy group in the configuration has a valid target. Don’t enter domain rules in the connection address or subscription URL fields.
-
Edit the rules
In Config, open the copy in the configuration editor and find the rules under [Rule]. Put specific domain exceptions first, broader matches later, and leave FINAL,DIRECT at the end.
-
Enable the configuration
After saving, select the copy in Config as the active configuration. Then go to Home → Global Routing → Config and make sure the routing mode isn’t still set to Proxy or Direct.
-
Reconnect
When it’s safe to interrupt your current network activity, turn the connection off and back on, then send a new web request. Don’t use an existing long-lived connection to judge whether the new rules are working.
This example sends download.example.com direct, routes other example.com subdomains through a proxy, and sends all other connections direct. If DOMAIN-SUFFIX is the first rule, download.example.com will match the proxy rule before the exact exception can take effect.
[Rule]
DOMAIN,download.example.com,DIRECT
DOMAIN-SUFFIX,example.com,PROXY
FINAL,DIRECT
Also check existing GEOIP, IP-CIDR, remote rule sets, and other broad rules. For example, IP-CIDR,192.168.0.0/16,DIRECT,no-resolve matches an IPv4 network, while GEOIP,CN,DIRECT uses IP geolocation data. Neither is a domain suffix rule. no-resolve means the IP rule won’t actively trigger a domain lookup; it doesn’t disable DNS for the entire client.
- If a broad PROXY rule appears earlier, unlisted domains may match it and never reach FINAL.
- If an earlier DIRECT rule matches the target, a later PROXY rule won’t override it.
- If you keep a remotely updated configuration, an update may overwrite your local edits. When testing, confirm whether you’re editing a local copy or a file managed by remote updates.
5. Check connection logs—not just whether the page loads
Test at least one matching request and one non-matching request. Visit a site covered by your rules and check that it matches the domain proxy rule. Then visit a site that isn’t listed or covered by another rule and check that it reaches FINAL and uses DIRECT. A page loading successfully only shows that one route worked; it doesn’t prove the traffic was routed as intended.
| Test case | What to check in the log | What to check first if something looks wrong |
|---|---|---|
| A listed root domain | Target hostname, DOMAIN-SUFFIX match, and proxy policy | Is the right configuration active? Is the rule in the right place? |
| A subdomain under the same root domain | Does the same suffix rule still match the subdomain? | Was an earlier, more specific rule matched first? |
| An unlisted website | FINAL match and DIRECT policy | Is there a broad keyword match or remote rule set? |
| Requests made by page components | Actual domains used for images, login, and API requests | Is a separate root domain missing, or is a redirect involved? |
Find the new request in Shadowrocket’s connection log and open its details. Check the target domain or IP first, then the matched rule and policy. If the policy uses a group, also check which connection was ultimately selected. If the log shows only an IP, don’t assume the DOMAIN-SUFFIX syntax is wrong. Check whether the app connected directly by IP and whether the client received the hostname information needed for domain matching.
- Note when you start testing. Close the target page, then open it again to reduce interference from older requests.
- Visit the target page once and find the corresponding new log entry. Don’t mistake requests from background apps for your test.
- If the homepage loads but login or images fail, check the related domains by timestamp and add only those confirmed to be necessary.
- Then test a site that isn’t listed and confirm it falls back to DIRECT.
6. Common questions about routing selected websites
Why are all sites still going through the proxy after I added rules?
First, check whether Home → Global Routing is still set to Proxy. Switch to Config, then check for broad proxy rules or remote rule sets near the top of the active configuration. FINAL,DIRECT only handles connections that haven’t matched an earlier rule; it doesn’t undo a match that already happened.
Can I proxy only one page on a website?
DOMAIN, DOMAIN-SUFFIX, and DOMAIN-KEYWORD don’t distinguish connections by URL path. If two pages are both on www.example.com, adding /video to a domain rule won’t route just one of them. Check whether the service uses a separate subdomain. Domain rules can distinguish the pages only if they use different hostnames.
The main page loads, but images and login don’t. Why?
Reload the page and check the connection log for the actual hostname used by the failed request. Login may redirect to another root domain, and images may come from a separate content delivery domain. Add confirmed proxy-required domains before FINAL, reconnect, and test again. Don’t add broad keyword rules just because the names look similar.
Can a subscription update overwrite my rules?
First, distinguish a connection subscription update from a remote Config update. The former mainly refreshes connection entries; the latter may replace rules in the configuration file. Keep a local copy, then check the active configuration and [Rule] in Config after updating. If a policy group references connection names, make sure those names still match.
The rule matches PROXY, but the site still won’t load. What should I check?
Check the connection actually selected, the connection test results, and any error logs. A rule match confirms that routing was selected; it doesn’t mean the remote connection is working. If you use a policy group, make sure it has a valid target. If other sites work, check the target site’s related domains and DNS results as well.