Shadowrocket Split Tunneling Rules: Route Selected Websites Through a Proxy with DOMAIN-SUFFIX

Learn how to use DOMAIN-SUFFIX, DOMAIN-KEYWORD, and FINAL,DIRECT in Config mode to route selected websites through PROXY and send all other traffic DIRECT.

At a glance

This guide is for users who already have a working proxy connection configured in Shadowrocket and want to route only selected websites through it. First, set Global Routing to Config, then place your domain rules near the top and finish with FINAL,DIRECT. The sections below cover a rules snippet you can merge into your configuration, how to save and enable it, and how to verify the results. They also explain how to tell a rule mismatch from a failed proxy connection.

Set Global Routing to Config first

“Route only selected websites through a proxy” involves two separate conditions: matching domains use PROXY, while all other requests default to DIRECT. Adding domain rules alone isn’t enough. If Global Routing is set to Proxy, requests are handled using global proxy routing, so you can’t use that mode to verify how this domain list routes traffic.

Open Global Routing on Home and select Config. Then, in Config, confirm which configuration file is active. The proxy connection selected on Home must also be working. This guide assumes you already have your own provider and subscription or connection details; it does not cover obtaining a connection service.

ModeHow it worksHow to use it here
ConfigRouting is determined by the rules in the active configuration.Required to verify routing by domain list.
ProxyRoutes traffic through a proxy globally, without using this guide’s domain list to decide how requests are routed.Can help you check whether the proxy works; switch back to Config after testing.
DirectRoutes traffic directly by default.Useful for a direct-connection comparison, but it cannot verify PROXY rules.
SceneApplies routing settings based on the configured scene conditions.When troubleshooting, switch explicitly to Config to reduce interference from scene changes.

On Demand establishes or restores connections based on conditions; it does not replace domain rules. If the connection changes automatically during testing, review the existing conditions under Settings → On Demand. Note the original settings, then temporarily manage the connection manually. Avoid changing On Demand, DNS, and rules at the same time, or it will be difficult to tell which change made a difference.

Minimal rules: DOMAIN-SUFFIX with FINAL,DIRECT

The following is a rules snippet, not a complete configuration with all connection parameters. example.com is a sample domain, not a recommendation for which websites to proxy. Replace it with the domain you want to route, then merge the rules into the [Rule] section of your existing configuration. Do not use this snippet to overwrite the entire file.

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

DOMAIN-SUFFIX,example.com,PROXY matches example.com itself and subdomains such as www.example.com and api.example.com. It matches by domain boundaries, so notexample.com won’t match just because it ends with the same letters.

2 lines
Minimal rule set: one domain match and one final policy
1 suffix
example.com matches the base domain and its subdomains
Last line
Place FINAL,DIRECT after all other rules

FINAL,DIRECT sends requests DIRECT when none of the preceding rules match. Rules are checked in order, and the first match determines the policy. A broader rule above your list—or a FINAL rule that appears too early—may intercept a request before it reaches the rule you added.

DOMAIN vs. DOMAIN-SUFFIX vs. DOMAIN-KEYWORD

How precisely your list matches depends on the rule keyword. Use DOMAIN-SUFFIX when both a website’s base domain and its subdomains should use the proxy. Use DOMAIN for a single hostname. DOMAIN-KEYWORD matches a string anywhere in the domain, so it has a broader scope and should not be treated as a drop-in replacement for a domain suffix.

Rule syntaxWhat it matchesBest used for
DOMAIN,api.example.com,PROXYMatches only api.example.com, not its subdomains.Routing a single, specific API hostname through the proxy.
DOMAIN-SUFFIX,example.com,PROXYMatches example.com and its subdomains.Maintaining a list by website domain.
DOMAIN-KEYWORD,example,PROXYMatches requests with example anywhere in the domain and may include unrelated domains.When keyword matching is necessary and you can check for unintended matches.

Do not include https://, a port, path, or query parameters in a domain rule. For example, enter example.com, not https://example.com/account. Domain-based routing cannot distinguish between HTTPS page paths on the same host.

To route one subdomain DIRECT while sending other requests under the same parent domain through the proxy, put the more specific exception before the suffix rule. In the example below, status.example.com goes DIRECT, while other matching domains use the proxy.

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

Save and enable your changes, one rule set at a time

Keep a copy of the original configuration before making minimal changes to your local file. A remote configuration update may overwrite local edits. Updating a connection subscription on Home is also different from updating a configuration file in Config. When troubleshooting, note the active connection and active configuration separately so you don’t mistake a change to the connection list for a loaded rule change.

  1. Back up the configuration

    Open Config, confirm which configuration is active, and keep a copy. Note the existing FINAL policy and any referenced rule sets so you can restore them if needed.

  2. Edit the rules

    In Config, open the local configuration you want to use and edit it. Add your domain list to the [Rule] section. Keep only one active final fallback rule in that section, with FINAL,DIRECT after your list.

  3. Save and select

    After saving, return to Config and make sure the file you just edited is selected—not another configuration with a similar name. If you see a parsing error, check the English commas, keyword spelling, and number of fields on each line.

  4. Set the routing mode

    Go to Home → Global Routing → Config and make sure a working proxy connection is selected. If needed, disconnect and reconnect so the test uses the current settings.

  5. Test again

    Close the target webpage and open it again to trigger a new connection. Then check the data log for the domain, matching rule, and actual policy. Don’t rely only on long-lived connections established before the change.

When copying rules from another configuration, check that the referenced policy names exist. Custom group names aren’t built-in keywords, and a policy group defined in one file may not exist in another. If you’re implementing the allowlist pattern in this guide, first verify it with PROXY and DIRECT, then consider adding policy groups.

Verify routing by checking the matched rule, not just whether a page loads

A page loading successfully only shows that some connection path worked; it doesn’t prove the proxy was used. In Shadowrocket’s data log, check the domain, rule, and outbound policy for the request you just made. If logging isn’t enabled, review the data logging settings in Settings, then make another request. Keep only the records you need, and remove sensitive information other than domains before sharing them.

Make a new request Identify the target domain Check rules in order Select an outbound route Review the log

A webpage may connect to several domains for the main site, login, static assets, and media. The main site matching PROXY while image requests match DIRECT isn’t necessarily a problem. If text loads but images or login fail, identify the actual domain used by the failed request before adding it to the list. Don’t broaden the match by adding an overly short DOMAIN-KEYWORD.

GEOIP matches based on the destination IP’s geographic information, while IP-CIDR matches an IP range; neither identifies which website a domain belongs to. A website may use multiple addresses, and an address may be shared by several websites. For a strict allowlist, don’t add broad IP proxy rules for convenience, or requests outside the list may also use the proxy. Requests made directly to an IP address also aren’t guaranteed to match domain rules.

Connection failures: distinguish rule issues from outbound issues

If the log shows a PROXY match but the request still fails, changing DOMAIN-SUFFIX rules usually won’t help. The examples below are low-level error snippets that may appear during connection diagnostics. The exact text depends on the protocol and point of failure; you may not see the same complete message every time.

Error: connection refused

Cause and fix: The destination or an intermediate device refused the connection. This doesn’t mean the domain rule failed. First check the actual outbound route in the log, then verify the address, port, and server listening status for your existing connection. Use the port from your own configuration; don’t change the proxy port to 443 just because the target website uses HTTPS.

Error: i/o timeout

Cause and fix: A read or write operation exceeded its time limit. This message alone can’t tell you whether the issue is with the local network or the proxy route. Keep the rules unchanged, make a fresh request over both Wi-Fi and cellular, and compare the results using the same proxy connection.

Error: certificate has expired

Cause and fix: A certificate used for TLS verification may be expired or otherwise invalid; the device’s clock may also be wrong. Check Settings → General → Date & Time on your iPhone, then ask your provider to verify the certificate. Don’t hide the issue by disabling certificate verification.

If the log shows DIRECT when you expected PROXY, check the rules: Is the correct file active? Is Global Routing set to Config? Did the request use a different domain? Is there an earlier matching rule above your list? Using this evidence to make targeted corrections is more effective than repeatedly rewriting the entire configuration.

FAQ: adding domains, updating rules, and restoring settings

To route just one website through a proxy, do I need to add every subdomain?

Usually, one DOMAIN-SUFFIX rule is enough for a site and its subdomains. Start with the base domain, then check the resource requests. If the site uses separate base domains for login or assets, add them based on the log. Don’t put a full URL in a rule.

I added rules, but every website still uses the proxy. What should I check?

First, go to Home → Global Routing and confirm Config is selected. Then check the active file in Config. Look for FINAL,PROXY, other broad proxy rules, or proxy rule sets. For a strict allowlist, requests outside your list should ultimately match FINAL,DIRECT.

Do I need to rewrite my list after updating my connection subscription?

Updating the connection list on Home usually doesn’t require rewriting domain rules in Config, but confirm which connection is selected. If you updated a remote configuration file, local edits may have been replaced. After an update, open the active configuration, check [Rule], and test one domain inside and one outside the list.

How can I restore the previous settings if something stops working after a change?

In Config, select the configuration copy you kept, then return to Home and restore the original Global Routing mode. Reconnect afterward. Once everything works again, add one rule at a time to the copy. Avoid restoring a configuration, changing the proxy connection, and modifying DNS all at once, or you may lose clues about the cause.

Check just three things when you’re done: Config is active, requests for listed domains match the expected rule, and other requests use DIRECT. For more on configuration structure, see the site’s technical reference. To compare routing modes, see proxy mode guide.

Download on the App StoreCheck the three official app details first