How to Proxy Specific Websites in Shadowrocket: DOMAIN-SUFFIX Rules and the FINAL Fallback

Route only selected domains through PROXY and send all other traffic to DIRECT with FINAL. Includes DOMAIN-SUFFIX, DOMAIN-KEYWORD, and IP-CIDR examples, plus rule order.

At a glance

This guide is for users who have already added a working connection to Shadowrocket and want to route only selected websites through a proxy. The key is to choose Global Routing → Config, place the target domain rules near the top of the active configuration’s [Rule] section, and finish with FINAL,DIRECT. The steps below cover configuration, domain matching, IP rule limitations, and how to verify the result in connection logs. Example domains and documentation-only IP ranges illustrate syntax; they are not real websites or usable services.

1. Make sure Global Routing is set to Config

An enabled connection switch does not necessarily mean traffic is being routed by your configuration. Shadowrocket’s connection switch enables network routing, while Global Routing determines how connections are handled. To proxy only selected websites, the configuration’s rules must be active. In Home → Global Routing, choose Config rather than Proxy or Direct.

How Global Routing options relate to this guide
OptionHow it worksHow to use it here
ProxyRoutes traffic through a global proxy without applying this guide’s domain rules.Can help check whether a proxy connection works, but is not the mode to use for this setup.
DirectRoutes traffic directly.Cannot verify a PROXY rule for a specific domain.
ConfigSelects a policy based on the rules in the active configuration.Leave this selected after setup.
SceneSwitches behavior based on configured scene conditions.Use Config while troubleshooting to avoid introducing scene changes as another variable.

This guide assumes you already have a provider and subscription. Get the subscription link from your provider, then confirm that the imported connection works. Rules determine which route a connection uses; they cannot fix an incorrect server address, port, or credentials. Settings → On Demand controls when connections start, not which domains use PROXY. Avoid changing both settings while testing for the first time.

2. Add a minimal rule set to the active configuration

Keep the original configuration and edit a copy for testing. Do not replace the entire configuration with the two lines below; the full file may also contain DNS, policy groups, and other required settings. This example shows the basic logic for a [Rule] section. If one already exists, edit its rules rather than creating a duplicate section.

  1. Back up the configuration

    Open Config, check which configuration file is selected, and save a copy first. A remote configuration update may overwrite local edits. For testing, use a local copy you can maintain and note the original contents before making changes.

  2. Edit the rules

    In Config, open the target file for editing and find [Rule]. Add a DOMAIN-SUFFIX rule for the target domain. If you use the rule editor form, set Type to DOMAIN-SUFFIX, enter the domain to match, and choose PROXY as the policy.

  3. Set the rule order

    Place target domain rules before any broader rules that could match first. Remove or adjust conflicting existing rules, and leave just one FINAL,DIRECT at the end of the rule section.

  4. Enable the configuration

    Save the file and select the edited configuration in Config. Go to Home → Global Routing → Config, make sure Home has a working connection selected, then turn on the connection switch.

  5. Create a new connection

    Close and reopen the page, then check Data for the new request’s domain, matched rule, and outbound policy. If an existing connection is being reused, disconnect and reconnect before repeating the test.

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

Replace example.com with the actual target domain; do not enter a full URL. PROXY means the proxy policy, and DIRECT means a direct connection. If you use a custom policy group, enter its exact name as defined in the configuration. Adding an undefined name at the end of a rule does not create a policy group.

3. DOMAIN-SUFFIX vs. DOMAIN-KEYWORD: matching scope

DOMAIN-SUFFIX matches at domain suffix boundaries. The rule for example.com can match example.com and api.example.com, but it will not match another domain just because it contains similar letters. DOMAIN matches an exact hostname. To proxy only a specific subdomain, use DOMAIN to keep the scope narrow.

DOMAIN,login.example.com,PROXY
DOMAIN-SUFFIX,example.org,PROXY
FINAL,DIRECT

Use DOMAIN-KEYWORD only when you need to match a group of domains by keyword and can accept extra matches. It is not the default choice for specifying particular websites. For example, the keyword example could also match notexample.net, unlike suffix-boundary matching. If you know the target domains, adding a separate DOMAIN or DOMAIN-SUFFIX rule for each is easier to review.

4. Rules are checked from top to bottom; put FINAL last

In standard rule matching, the first matching rule determines the policy for a connection; later rules do not override it. FINAL is the fallback for connections that did not match earlier rules. To proxy only domains on your list, put those rules first and end with FINAL,DIRECT, not FINAL,PROXY.

Request enters the tunnel Rules are checked in order First match selects the policy Traffic uses the selected route
[Rule]
DOMAIN,local.example.com,DIRECT
DOMAIN-SUFFIX,example.com,PROXY
DOMAIN-SUFFIX,example.org,PROXY
FINAL,DIRECT

The example first makes local.example.com a direct-connection exception, then routes other matching hosts under example.com through the proxy. If you reverse the rules, DOMAIN-SUFFIX will match local.example.com first, so the exact exception below it will never apply. This is a common reason a connection still uses the proxy even though a DIRECT rule is present.

5. Use IP-CIDR for fixed addresses, not as a substitute for a domain

Use IP-CIDR if you know the target’s fixed IPv4 address. Use /32 for a single address; for a subnet, choose a prefix length that matches the actual network range. The addresses below are reserved for documentation examples only. They are syntax samples, not servers you can connect to.

[Rule]
DOMAIN-SUFFIX,example.com,PROXY
IP-CIDR,192.0.2.25/32,PROXY,no-resolve
IP-CIDR,198.51.100.0/24,DIRECT,no-resolve
FINAL,DIRECT

no-resolve means the rule will not trigger a DNS lookup solely to match the IP address. It does not disable DNS or route all DNS requests through the proxy. If a request already targets an IP, the rule can check whether the address falls within the subnet. If the request has only a domain and no available IP address, a no-resolve rule cannot replace a domain rule.

Choose a rule for the target
TargetRecommended ruleImportant
One HTTPS host using port 443DOMAIN or DOMAIN-SUFFIXDo not add :443 to the domain; the port is not a match field for these rules.
A fixed IPv4 addressIP-CIDR, using /32 for a single addressConfirm the actual address; do not use documentation example addresses for connectivity tests.
A website that uses a CDNIdentify the required domains and match each one separatelyAddresses may change or be shared with other sites, so one fixed IP may not reliably represent the entire website.

6. Use connection logs to distinguish a rule mismatch from a route failure

For verification, check at least two new connections: one to a target website on your list, and one to a website not on the list that should connect directly. The first should show the target domain rule and PROXY; the second should match FINAL and use DIRECT. These are expected results only—use new connection records in Data on your device to confirm what actually happened. A page loading or failing in the browser is not enough to determine the cause.

  1. Note the domain rules you changed and the expected policies, then save and select the configuration.
  2. Return to Home and verify Global Routing → Config and the currently selected proxy connection.
  3. Make a new request, find it in Data by its timestamp, and check the actual domain, matched rule, and policy.
  4. If the request matches PROXY but fails, check the connection settings and remote reachability. If it falls through to FINAL,DIRECT, check the rule scope or selected configuration first.

A browser error means the request failed, but it does not by itself prove that a rule is wrong. The text below shows error identifiers a browser may display; these are not Shadowrocket rule-parsing messages. First check which policy handled the request, then decide whether to troubleshoot DNS or the proxy connection.

Error: ERR_NAME_NOT_RESOLVED

Cause and fix: The browser could not resolve the domain to a usable address. Check the spelling and the DNS settings in Config, and make sure you have not entered a full URL as the rule value. Changing FINAL repeatedly will not fix a DNS problem.

Error: ERR_CONNECTION_TIMED_OUT

Cause and fix: The connection did not complete before the timeout. Check the outbound policy in Data. If the request matched PROXY, verify the address and port of your existing proxy connection and check network reachability. If it shows DIRECT, check whether the target domain is missing from your rules or matched by an earlier rule.

If you still see the old policy after changing rules, consider connection reuse. Established connections usually do not switch routes automatically when you save rule changes, and the browser may continue reusing an existing connection. Close the target page, reconnect, and try again; this is a better test than repeatedly refreshing a page over the same long-lived connection.

7. FAQs about routing specific websites

Why does login still fail after I add one domain?

Check Data for new requests created when you tap the login button. The login service may use a different domain that is not covered by the home page’s DOMAIN-SUFFIX rule. Identify the failing host, add a specific rule, save, and try logging in again. Do not change FINAL to PROXY to hide a missing rule.

Will FINAL,DIRECT send all websites through a direct connection?

Only connections that do not match an earlier rule use this fallback. If all requests show DIRECT, check that Home → Global Routing is set to Config, that the selected file in Config is the one you edited, and that the target rule is not below FINAL.

Why did my rules disappear after a subscription update?

First, distinguish a server subscription update from an update to a remote configuration file. A change to the server list does not necessarily change the active [Rule] section, but downloading a remote configuration again may overwrite local edits. Open the active file in Config and check its contents. Keep rules you need to maintain in a local copy, and confirm the selected configuration after updates.

Can I proxy just one path on a website?

DOMAIN-SUFFIX and DOMAIN-KEYWORD cannot distinguish /video from /account on the same domain. These rules match domains, not page paths encrypted by HTTPS. Base your rules on the actual domains involved; do not append a path to the domain value.

Keeping the rule list minimal makes it easier to maintain: use DOMAIN or DOMAIN-SUFFIX for specific targets, add IP-CIDR only when you need a fixed address, and finish with FINAL,DIRECT. Verify every added rule with a new connection. For more help checking connection settings, see Troubleshooting. For an explanation of routing modes, see Proxy Modes.

Download Shadowrocket