To proxy only selected websites in Shadowrocket, add rules in Config that send the target domains to PROXY, then use FINAL,DIRECT to connect unmatched requests directly. This guide is for users with a working proxy connection who want to limit which traffic uses it. After setup, test one matching domain and one non-matching domain to confirm both routes instead of guessing based on whether a page loads.
DOMAIN-SUFFIX or DOMAIN-KEYWORD: Which Should You Use?
When you know the target domain, use DOMAIN-SUFFIX (domain suffix matching). For example, DOMAIN-SUFFIX,example.com,PROXY matches both example.com and www.example.com, but not notexample.com. It matches by domain label, not by simply checking the end of a string. To proxy one exact hostname only, use DOMAIN (exact domain match) so other subdomains are not included.
DOMAIN-KEYWORD (domain keyword matching) checks whether the hostname contains a specified string. It does not check the page title, URL path, or query parameters. For example, the keyword assets-demo could match both assets-demo.example.com and assets-demo.example.net. Even domains belonging to different sites can match the same rule. When you can list exact domains, avoid using a broad keyword just to save a few lines.
Narrow the match before troubleshooting the connection
If a keyword rule also sends a comparison site through the proxy, replace the keyword with an exact domain rule. Changing the proxy port does not change which domains match.
Add rules in Config and switch Global Routing
The snippet below shows the format of a [Rule] section; it is not a complete configuration file. example.com demonstrates suffix matching. The keyword line starts with a semicolon, making it a comment; leave it commented out during the initial test. Do not include https://, a path, a port, or *. in rule domains.
[Rule]
DOMAIN-SUFFIX,example.com,PROXY
; DOMAIN-KEYWORD,assets-demo,PROXY
FINAL,DIRECT
- Find the configuration you are using. Open Config and confirm which configuration file is selected. Keep the original file or back up its existing rules before editing. To test separately, make changes in a copy and decide whether to replace your everyday configuration after verification.
- Add the rules to the existing
[Rule]section. Do not paste the section header a second time. Check whether an existing rule for the target domain points toDIRECTorREJECT. If an earlier rule matches first, a new rule added later will not determine the outcome. - Check which rules appear before the fallback. Put
FINAL,DIRECTat the end of the rules, replacing the existingFINALrather than adding a second one. If the original configuration still has proxy rules such asGEOIP,IP-CIDR, or other domain rules, unlisted requests may match those first. To test the minimal example, remove unrelated matching rules from a test copy. - Enable rule-based routing. Save and select the edited file, then return to Home and open Global Routing. Select
Config. Make sure your proxy works, then connect. IfProxyorDirectis still selected, the result cannot confirm whether these configuration rules are working.
Test one matching request and one non-matching request
Keep the network, proxy, and configuration the same, and test one change at a time. Open a new browser page for each request; if refreshing does not create a new connection, close the old tab and open a new one. If request logs are available, find each new request by hostname and time, then check its matched rule and policy. The results below are what to expect with the example configuration, not a guarantee of connectivity.
| Request hostname | Expected rule | Expected policy |
|---|---|---|
example.com | DOMAIN-SUFFIX,example.com | PROXY |
www.example.com | DOMAIN-SUFFIX,example.com | PROXY |
example.org | FINAL | DIRECT |
If you cannot see request logs, return to Config to check that the rules were saved and are in the right order, then check that Home → Global Routing is still set to Config. A page loading only confirms that the request succeeded; it does not prove that it used the proxy. Do not use a public IP lookup page that is not on your proxy list to check a target site's exit IP. The lookup page's own domain determines which route it takes.
The rule matches, but the page still will not load
Separate routing from connectivity: a PROXY match means the request selected the proxy policy; it does not mean DNS, the proxy connection, or the destination site is working. The errors below are messages a browser may display, not Shadowrocket rule errors.
Error: ERR_NAME_NOT_RESOLVED
Cause: The browser could not resolve the hostname in the failed request. The domain may be mistyped, or there may be a problem with DNS resolution. What to do: First check whether the failed hostname is the initial domain or a redirected one. On the same network, test a known resolvable domain for comparison. Do not broaden the proxy rules as a first step.
Error: ERR_CONNECTION_TIMED_OUT
Cause: The connection was not established in time; the error alone does not show which part timed out. What to do: First check whether the failed request used PROXY or DIRECT. If several destinations time out through the same proxy, check proxy connectivity. If only one subdomain fails, check that hostname and the rule it matches.
Common questions about routing selected sites
The homepage loads, but why won't the login page or images load?
Redirects, login pages, and static assets may use different hostnames. Identify the specific failed request first. If it matches FINAL,DIRECT and does need a proxy, add that hostname as a separate rule. Do not proxy an entire broad suffix just to cover one login domain.
Can I proxy only /login on a domain?
Not with the domain rules in this guide. Neither DOMAIN-SUFFIX nor DOMAIN-KEYWORD checks URL paths. /login and /help on the same hostname cannot match different domain rules based on their paths. If the service has a separate login domain, you can add a rule for that hostname.
I added FINAL,DIRECT. Why are other sites still using the proxy?
First check that Home → Global Routing is set to Config, then confirm you edited the currently selected configuration. If both are correct, check whether the request matched an earlier keyword, rule set, or IP rule. FINAL applies only to traffic that did not match an earlier rule; it does not override a policy already selected.
Why did my manually added rules disappear after updating a remote configuration?
First check the selected file and its [Rule] section in Config. Updating a remote configuration may replace its contents. Keep manually added rules in a separate local copy. When merging remote changes, recheck the rule order, fallback policy, and both comparison requests.
Get Shadowrocket and browse the guides
Get Shadowrocket for iPhone and iPad from the App Store for a one-time payment of $2.99. Check the App Store listing for system requirements. The Mac (Apple silicon and Intel), Windows, Android, and Linux versions are free; download their installers from this site's download page.
The App Store listing should show Shadow Launch Technology Limited as the developer and 932747118 as the app ID.