To proxy only selected websites, three conditions must be met: set Global Routing to Config, match the target domain with a PROXY rule, and use FINAL,DIRECT as the fallback for all other requests. This guide is for users who already have a provider and a working connection configuration. Follow the steps to back up, edit, enable, and verify your rules, with domain exceptions to show why rule order matters.
1. Define the scope: route by domain, not by URL
Shadowrocket’s DOMAIN-SUFFIX matches domain suffixes. Enter example.com to match the domain itself and subdomains such as www.example.com and api.example.com. It does not search for text in the browser’s address bar or depend on the page title.
To include a whole site and its subdomains, use DOMAIN-SUFFIX. To proxy only one specific hostname, use DOMAIN. Do not include https://, a path, query parameters, or a port in the domain field. For example, when visiting https://example.com:443/account, enter only example.com as the domain.
| Rule | Matches | Does not match |
|---|---|---|
DOMAIN,example.com,PROXY | example.com | www.example.com |
DOMAIN-SUFFIX,example.com,PROXY | example.com and its subdomains | badexample.com |
DOMAIN,api.example.com,DIRECT | api.example.com | www.example.com |
The example domains are for illustrating syntax only; they are not working proxy services. Rules determine which policy handles a request. They do not create connection details or restore an unavailable proxy connection.
2. Back up first, then add minimal rules in Config
Before you begin, check Home to make sure you have a working proxy configuration. If your connection details come from a subscription you already use, update it if needed, then confirm that the selected proxy connects successfully. Editing rules and updating a subscription are separate tasks: rules change how requests are routed, while subscription updates usually refresh connection details.
- Keep the original configuration. In Config, use the configuration controls to make a copy or export a backup. Note which configuration is currently in use so you can restore it if needed.
- Open the configuration you want to edit. In Config, open its editor and find the rules section. If you are editing the text, locate
[Rule]. - Review existing rules. Check for existing
FINALrules, broad domain rules, or rules that point to other policies. Do not simply append the new rules after an existing fallback rule. - Save and enable. Save your changes, then confirm in Config that the edited configuration is enabled—not another file with a similar name.
This minimal example needs only two rules. The snippet below is a rules section, not a complete connection configuration. Add it to the rules section of your existing configuration; do not replace the entire file with it.
[Rule]
DOMAIN-SUFFIX,example.com,PROXY
FINAL,DIRECT
The first rule sends example.com and its subdomains to PROXY. The last rule sends requests that did not match any earlier rule to DIRECT. PROXY uses the currently selected proxy; DIRECT connects to the destination directly. If your configuration uses custom policy groups, verify their names and available options. Do not use a rule name that does not exist.
3. Set Global Routing to Config to apply these rules
Return to Home, open Global Routing, select Config, and then connect. This setting determines the overall routing mode: selecting Proxy does not mean “proxy only the sites in the rules,” and selecting Direct will not apply the specific-site proxy rules in this guide.
| Mode | How it works | What to select for this scenario |
|---|---|---|
Config | Uses the rules in the currently enabled configuration to choose a policy. | Select this to verify the rules in this guide. |
Proxy | Routes traffic through the proxy by default. | Not suitable for verifying that other traffic is routed directly. |
Direct | Connects directly by default. | Not suitable for verifying PROXY rules for specific domains. |
Scene | Uses the configured scene to determine how traffic is handled. | For initial troubleshooting, use Config to reduce variables caused by switching scenes. |
Settings → On Demand controls when a connection is established automatically; it is not where you edit a list of websites. Even with On Demand configured, check the active configuration, Global Routing setting, and selected proxy. Automatic connection and traffic routing after connection are separate settings.
- The target website should use a proxy: check that Global Routing is set to
Config. - The target rule is saved: confirm that Config has the edited configuration enabled.
- The rule matches
PROXY: check that the currently selected proxy on Home is working.
4. Put exceptions first and FINAL last
Rules are evaluated in order, and the policy for the first match is applied. Suppose you want all of example.com to use a proxy, except assets.example.com, which must connect directly. Put the more specific exception before the broader suffix rule. Otherwise, the asset hostname will match the suffix rule first, and the later exception will never take effect.
[Rule]
DOMAIN,assets.example.com,DIRECT
DOMAIN-SUFFIX,example.com,PROXY
FINAL,DIRECT
In short: exceptions first, broader matches next, fallback last
If a subdomain is routed incorrectly, compare it with the rules above it one by one. Start by fixing the rule order; do not immediately change protocols or rebuild the connection configuration.
Also check for existing GEOIP and IP-CIDR rules. These match IP ranges or geographic locations, not website domain lists. IP-based rules and DNS settings can also affect matching. For strict “proxy listed domains, connect directly to everything else” routing, review every existing rule that could send traffic through a proxy—not just the final FINAL,DIRECT rule.
5. Test three types of requests; latency tests do not verify routing
After saving, reconnect and have the test page make a new request. The browser may reuse existing connections, and cached pages may not generate the new request you expect when refreshed. Try closing the tab and reopening it, then check the app’s connection log for the destination hostname and policy used.
| Test case | Expected matching rule | Expected policy |
|---|---|---|
www.example.com | DOMAIN-SUFFIX,example.com,PROXY | PROXY |
assets.example.com | DOMAIN,assets.example.com,DIRECT | DIRECT |
| An actual test domain not on the list | FINAL,DIRECT | DIRECT |
The table shows expected results for the example configuration; it is not a report of tests performed on the example domains. For your own checks, use domains you need to access. A latency test can help assess the selected proxy connection, but it cannot show which rule handled a particular web request. Verify routing using the request’s hostname, matching rule, and policy in the connection log.
A webpage often connects to more than one domain. The main content may come from the primary site, while login, images, scripts, or media load from other domains. If only images fail to load, check the hostname used by the failed request before adding a rule. Do not switch all traffic to Proxy just because one resource failed.
- Record the failed resource’s full hostname; do not use the page title as a rule target.
- Decide whether to match only this hostname or cover all subdomains under its domain.
- Choose
DOMAINorDOMAIN-SUFFIX, and place the new rule beforeFINAL. - Send the request again, confirm the policy changed, then check whether the resource loads.
6. If the rule matches but access fails, troubleshoot the connection separately
“Wrong policy” and “correct policy, but connection failed” are different problems. First confirm whether the request matched the expected rule. If it matched PROXY, check the specific connection error. The messages below are examples of English text that may appear in connection errors; refer to the in-app log for the actual details.
Error: Connection refused
Cause and fix: The destination or an intermediate device explicitly refused the connection. Check the log to see whether the failed connection was to the proxy server or the website, then verify the relevant address, port, and service status. A refused connection does not by itself mean that the domain rule failed.
Error: Operation timed out
Cause and fix: The connection did not complete before the timeout. First confirm the policy used for the request, then check whether the selected proxy is reachable or whether the destination website accepts a direct connection. Verify the address and port provided by your existing service provider.
If the same destination fails with DIRECT but works with PROXY, that only shows that the two connection paths behave differently. It does not mean every website needs a proxy. If both paths fail, check domain resolution, the destination service, and your network environment rather than repeatedly adding duplicate rules.
Why are other websites also going through the proxy after I added a rule?
First, go to Home → Global Routing and confirm that Config is selected. Then check the other rules in the active configuration under Config. A broader PROXY rule may still match requests outside your list; the final FINAL,DIRECT rule applies only to requests that did not match anything earlier.
Should I use a suffix rule to proxy just one subdomain?
If you only need to proxy api.example.com, use DOMAIN,api.example.com,PROXY. If you also need to cover its subdomains, consider DOMAIN-SUFFIX,api.example.com,PROXY. The two rules cover different scopes.
Only the login page on a website will not open. What should I do?
Trigger the login request again and check the connection log for the hostname used by the login service. If it is not covered by the configured domain suffix, add a separate rule if needed. Do not put the login URL’s path or query parameters in DOMAIN-SUFFIX.
Why did my rules behave differently after updating a subscription?
First, check on Home whether the previously selected proxy is still available and working. Then verify which file is enabled under Config. If you also updated a remote configuration, compare it with your backup to see whether the rules were replaced. Restore the local rules you have verified, then test again.
Keep the same final check sequence: enable the correct configuration, select Config, verify match scope and rule order, check the request policy, then troubleshoot connection errors. This helps separate configuration issues from network issues. Change one variable at a time so you can tell what made a difference.