Shadowrocket Website Proxy Rules: DOMAIN-SUFFIX and FINAL Fallback

Learn how to route selected websites through PROXY and keep all others on DIRECT, order rules correctly, set a FINAL fallback, and verify the results.

At a glance

To route selected websites through a proxy in Shadowrocket, three things must be in place: select Config under Home → Global Routing; make sure the active configuration includes rules for the target domains in [Rule]; and use FINAL,DIRECT to handle all remaining requests. This guide starts with a minimal configuration and covers syntax, rule order, activation, and testing. It assumes you already have your own service details and does not recommend services.

1. Global Routing vs. rule policies

Global Routing determines the routing mode for connections, while PROXY or DIRECT at the end of a rule determines how a matching request is handled. These are separate settings. Even with rules for specific websites in your configuration, you cannot verify domain-based routing if Global Routing is set to Proxy or Direct.

Global Routing optionWhat it does and how this guide uses it
ConfigProcesses requests using the rules in the active configuration. This is the option used in this guide.
ProxyRoutes traffic through the proxy path. This does not test whether only selected websites use the proxy.
DirectConnects directly, rather than routing selected websites through PROXY as described here.
SceneSwitches routing behavior according to the configured scene. For troubleshooting, select Config first to reduce variables caused by scene changes.

PROXY in a rule requires a working proxy destination; it does not create a service or supply a server address, port, or authentication details. DIRECT sends the request straight to its destination—it does not turn off Shadowrocket's connection toggle. Requests using DIRECT can still be evaluated and logged by the app.

1
Setting used throughout this guide: Global Routing → Config
2 lines
Minimal rules: DOMAIN-SUFFIX and FINAL
2 sets
Test targets: a target domain and a non-target domain

In short: set the routing mode first, then edit the rules

Set Global Routing to Config before testing a target domain and another domain. Don't edit [Rule] while switching between Proxy, Direct, or Scene; otherwise, you won't know which change caused the result.

2. Minimal DOMAIN-SUFFIX rule syntax

This minimal snippet illustrates the rule structure; it is not a complete configuration with all connection details. example.com is a sample domain. Replace it with a domain you want to route, and keep any required settings in your existing configuration. Save a copy of the current configuration before editing.

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

DOMAIN-SUFFIX,example.com,PROXY matches the domain suffix, including example.com itself and subdomains such as www.example.com and api.example.com. It does not match notexample.com just because the name contains the same text. Separate fields with English commas. Don't include a scheme, port, path, or wildcard in the domain field.

Domains that don't share a suffix need separate rules. A webpage may also load images, sign-in pages, or API calls from separate domains, so a working homepage does not mean every request uses the same route. Add rules based on the actual hostnames in request logs rather than routing large public domains wholesale.

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

3. Rules match from top to bottom; put FINAL last

In the standard rule list used here, requests are evaluated from top to bottom, and the first matching rule determines what happens next. Put specific exceptions before broader rules, and place FINAL at the end. If FINAL comes before a target rule, that rule will never get a chance to match.

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

The expected result is: local.example.com uses DIRECT, www.example.com uses PROXY, and requests that match neither of the first two rules use DIRECT. If you swap the first two lines, local.example.com matches the suffix rule first, so the direct-connection exception won't work.

KeywordWhat it matchesWhat to check in this scenario
DOMAINFull domain nameUseful for a single host or a more specific exception.
DOMAIN-SUFFIXDomain and its subdomainsThe main rule for routing an entire website's domain and subdomains through PROXY.
IP-CIDRIPv4 address rangeFor example, IP-CIDR,192.168.0.0/16,DIRECT,no-resolve. Don't treat this example range as covering every local network.
GEOIPIP geolocation database matchFor example, GEOIP,CN,DIRECT. This does not determine a website's language or the region associated with its domain.
FINALRequests not matched by any earlier ruleThis guide uses FINAL,DIRECT at the end of the rule list.

For routing a few domains through a proxy and everything else directly, you usually don't need to add GEOIP: FINAL,DIRECT already handles the remaining requests. Extra IP rules add variables when troubleshooting. If you keep existing GEOIP or IP-CIDR rules, check that they don't intercept requests before the target domain rules. no-resolve means the IP rule won't actively resolve domain names for matching; it does not disable all DNS queries.

4. Edit and activate the configuration

These steps use the Home, Config, and Settings screens on iPhone and iPad. First, make sure your existing service connection details work, then adjust routing. Protocols and domain rules operate at different levels: connection parameters for Shadowsocks, VMess, VLESS, Trojan, Hysteria2, and WireGuard come from your service configuration. Don't change protocols or ports at random to make DOMAIN-SUFFIX work.

  1. Save a copy

    Open Config and check which configuration is active. Save a copy or export a backup before editing. Don't rely on the filename to tell you whether a configuration is active, and don't replace the entire configuration file with just two rules.

  2. Edit the rules

    In Config, open the editor for the target configuration and find [Rule]. Put the target domain's DOMAIN-SUFFIX rule before broader rules. Check the English commas and domain spelling, and avoid adding a second [Rule] section.

  3. Set the fallback

    Check the FINAL rule at the end and set the fallback used in this guide to FINAL,DIRECT. If the original configuration has another FINAL, consolidate the rules into one clear fallback at the end rather than appending more rules after it.

  4. Activate the configuration

    Save your changes and make sure the configuration is active in Config. Go to Home → Global Routing and select Config. Check the proxy selection on Home to make sure the route used by PROXY is available, then turn on the connection.

  5. Test again

    Close existing webpage connections and start a new visit. If needed, disconnect and reconnect Shadowrocket. If Settings → On Demand has automatic connection conditions set up, note their status before testing so connection changes aren't mistaken for rule changes.

5. Verify matches with two sets of requests—not just whether a page loads

A page loading only shows that the request received a response; it doesn't prove the request used PROXY. To verify routing, match the target domain, matched rule, final policy, and connection result. Test a target domain first, then a non-target domain, changing one condition at a time.

  1. Note the starting state. Confirm Global Routing is set to Config and note the active configuration and selected proxy entry. Use request logs in Data to check connections generated by the test.
  2. Test the target host. Visit a website whose domain is actually in your rule and find its new request. It should match the target DOMAIN-SUFFIX or DOMAIN rule and use PROXY.
  3. Test a non-target host. Visit a host not covered by any earlier rule. With this guide's configuration, it should match FINAL and use DIRECT.
  4. Check dependencies one at a time. If text loads but images or sign-in fail, find the hostnames of failed requests from the same time period. Check whether they're separate domains before deciding whether to add rules.

HTTPS websites commonly use destination port 443, and HTTP websites commonly use 80, but the port number alone doesn't show whether traffic used a proxy. The proxy server's connection port is a separate detail and must match your own service parameters. Browser caching, connection reuse, and background requests can affect what you see, so check newly created records rather than repeatedly inspecting the same old connection.

What you seeNext step
Target domain matches FINAL,DIRECTCheck the domain spelling, active configuration, and whether the request went to a different host.
Target domain matches PROXY, but the connection failsThe rule selection is as expected. Next, check the proxy connection parameters, reachability, and target response.
A non-target domain also uses PROXYCheck whether Global Routing is set to Proxy and whether a broader proxy rule appears earlier in the list.
No new request recordsStart a new connection and check the cache, connection toggle, and effects of other network tools. Don't assume the rules are invalid.

6. Troubleshoot connection errors and rule mismatches separately

Troubleshoot rule issues separately from transport errors. First check whether the final policy is correct, then find out why the connection failed. The messages below are examples of network errors; the actual text may include an address or system prefix. Check the logs on your device rather than attributing every failure to DOMAIN-SUFFIX.

Error: Connection refused

Cause: The destination or an intermediate device actively refused the connection, often because no service is listening on the port or the connection parameters are incorrect. Fix: First check whether the failed connection used PROXY or DIRECT, then verify the corresponding server address and port. If the domain rule matched correctly, don't broaden the suffix to try to fix a refused connection.

Error: Connection timed out

Cause: The connection didn't complete in time. The issue may involve the network path, service reachability, or an unresponsive destination. Fix: Keep the current rules and compare with another known-working request. Determine whether the entire proxy path is failing or just one website, then check your service parameters and network status.

If a page fails but the logs show DIRECT, fix the rule match first. If the logs show the expected PROXY route, troubleshoot the proxy connection. Routing by visible hostname usually doesn't require HTTPS decryption or a certificate to read page content. Don't add unrelated decryption settings just to route by domain.

7. Common questions about routing selected websites

Can I use DOMAIN-SUFFIX to proxy only a specific page path?

No. DOMAIN-SUFFIX matches domain suffixes and doesn't distinguish between /news and /account on the same host. Paths on the same host use the same policy under these rules. Don't append a URL path to the domain field.

Will FINAL,DIRECT override earlier PROXY rules?

No. When FINAL,DIRECT is at the end, it handles only requests not matched earlier. If a target website still uses DIRECT, check the actual hostname in Data, then make sure its rule appears before FINAL in Config.

The homepage loads, but images and sign-in fail. What should I do?

Reload the page and check requests from the same time period to find separate domains used for images, sign-in, or API calls. Once you've confirmed they need the same route, add DOMAIN or DOMAIN-SUFFIX rules one at a time before FINAL, testing after each addition.

Do I need to rewrite all my website rules when I switch proxies?

With the generic PROXY target, you usually don't need to change the domain conditions, but check the current proxy selection on Home. If a rule refers directly to a custom policy group, make sure the group name still exists and new requests use the expected policy.

Download Shadowrocket