Shadowrocket On Demand Setup: Auto-Connect by Wi-Fi, Cellular, and Domain

Learn how On Demand combines Wi-Fi names, cellular connections, and domain matching, and how rule order affects which condition takes priority.

At a glance

First choose which networks should trigger an automatic connection, then decide whether to connect only when a specific domain is accessed. Using an iPhone or iPad that already connects manually from Home, this guide shows how to set a home Wi-Fi exception, cellular triggers, and domain conditions for other Wi-Fi networks in Settings → On Demand. Three test scenarios help distinguish On Demand trigger issues from routing problems after connection.

On Demand vs. Global Routing: Check the Connection, Then Routing

Open Settings → On Demand to configure automatic connections. On Demand lets the system decide whether to start the VPN when specified network conditions or connection requests occur. Global Routing handles traffic after the connection is established. Even if a domain has a PROXY rule in Config, that routing rule cannot start the connection in place of On Demand.

Network conditionOn Demand evaluationTunnel statusTraffic routing
2 network types
This guide tests Wi-Fi and cellular separately
2 decision layers
On Demand decides when to connect; Global Routing decides how to handle traffic after connection

Bottom line: Choose where to troubleshoot based on Home connection status

After a request, if Home still shows disconnected, check the current network and On Demand conditions first. If Home shows connected but websites behave unexpectedly, check Global Routing and the active Config.

Wi-Fi Names and Cellular: Set Exceptions Before General Conditions

Before you start, connect manually from Home and open a website that normally works to confirm the connection is available. If manual connection fails, fix that first, then test automatic triggers. Next, find the current SSID (network name) in your system Wi-Fi settings and enter it exactly as shown in the On Demand Wi-Fi name condition. Don't enter the router's admin address, Wi-Fi password, or device name.

Home Wi-Fi: Disconnect Exception

Network type
Wi-Fi
SSID
Home-WiFi (example; replace with the name shown by your system)
Action
Disconnect
Order
Place it before Wi-Fi conditions that don't specify an SSID

To verify, switch to your home Wi-Fi while connected and check that the tunnel disconnects. Don't just confirm that it stays off when already disconnected.

Cellular: Connect Automatically

Network type
Cellular
SSID
Leave blank; SSIDs are used only to match Wi-Fi networks
Action
Connect
How to test
Turn off Wi-Fi, confirm cellular data is available, then make a new request

Use this setting to connect automatically on cellular. If you want only a specific domain to trigger a connection, use a domain evaluation condition for that network instead of keeping a general Connect rule ahead of it.

If you have separate home and guest networks, check the names shown by your system and enter only the SSIDs that need an exception. The same network name may appear elsewhere; SSID matching checks the name, not the identity of the access point, so it isn't a security check.

Domain-Based Auto-Connect: Domain Evaluation vs. Config Routing Rules

To trigger a connection only when a specific domain is accessed on other Wi-Fi networks, check whether your current setup offers a domain evaluation condition in Settings → On Demand. Use it for Wi-Fi networks not covered by the home Wi-Fi exception. Domain evaluation can run only after the corresponding network rule is selected. It's not a global listener, and adding a domain to Config alone won't enable it.

  1. Enter a hostname first. Use example.com as a format example. Don't include https://, a path, query parameters, or a port. For testing, use the hostname you need to access and check separately whether subdomains also match. Don't copy the Config DOMAIN-SUFFIX syntax into the domain field.
  2. Then check the trigger condition. System domain evaluation can decide whether to connect based on DNS resolution or probe results. For example, if a rule connects only when DNS resolution for a specified domain fails, the VPN not starting when that domain resolves normally on the current network may be the expected result.
  3. Finally, test the requests. On the target Wi-Fi network, make new requests to a non-target hostname and the target hostname separately while the VPN is disconnected. Check whether Home changes to connected. Reusing an open page, an existing connection, or cached DNS results may not reproduce the trigger conditions for a first visit.

If the current interface doesn't offer a domain evaluation condition, first test On Demand by network type, then use Config mode in Global Routing to control routing after connection. These two lines only illustrate routing in the [Rule] section: the first matches example.com and its subdomains; the second sends other traffic to DIRECT. They won't make the system start the VPN automatically based on a domain.

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

Rule Order: The First Matching Network Rule Applies

The system checks On Demand network rules in order and uses the first matching rule. A later rule with a more specific SSID doesn't automatically take priority. If a rule specifies both Wi-Fi and an SSID, both conditions must be met. Domain evaluation is an action of the selected network rule; if the domain doesn't match, that doesn't mean the system continues to the next network rule looking for Connect.

OrderNetwork conditionAction and expected result
Rule 1Wi-Fi, SSID Home-WiFiDisconnect: Disconnect when returning to home Wi-Fi; don't run the Wi-Fi domain evaluation below.
Rule 2CellularConnect: Requests on cellular data don't require visiting a specific domain first.
Rule 3Wi-Fi, any SSIDEvaluate domain: Rule 1 handles home Wi-Fi; evaluate the configured domain condition only on other Wi-Fi networks.

A common conflict is placing “any Wi-Fi → Connect” before the home SSID rule, so the VPN still connects automatically when you get home. Move the home exception before the general Wi-Fi rule, then retest on the same device. If the interface doesn't let you reorder rules, disable the overlapping general condition first, test the specific condition on its own, then decide whether to keep both. When testing domains, make sure there isn't also a Wi-Fi Connect rule that matches first.

Unexpected Connection Behavior: Test Each Network in Turn

Change one setting at a time and note the current network, hostname accessed, and Home status before and after the request. For cellular tests, make sure the device is off Wi-Fi. On other Wi-Fi networks, complete any required captive portal login before testing domain triggers. A successful visit while the VPN was already connected only proves that the website was reachable at that time; it doesn't prove that the request started the VPN.

Why does the VPN stay on after I get home and connect to Wi-Fi?

Check the actual SSID in system settings and make sure you're not connected to a guest network or another network with a similar name. Go to Settings → On Demand, confirm the home condition is Disconnect, and check whether a rule covering all Wi-Fi networks appears before it.

Why doesn't the VPN connect as soon as I turn off Wi-Fi?

First confirm cellular data is on, then make a new web request and check Home. If your cellular condition uses domain evaluation, test with a request that meets the condition. If you've set Connect and the VPN still doesn't start, check that On Demand is enabled and verify which configuration is selected in the system VPN settings.

Why does the VPN connect when I visit other websites if I set only one domain?

Disable any Connect condition that matches first on the current network, then retest while disconnected. A webpage may also request other hostnames for sign-in, images, or static resources; the hostname in the address bar doesn't mean the page made only one request.

Home shows connected, but the target website isn't using the proxy rule. Why?

Check whether Global Routing is set to Config, then verify the active configuration and the hostname actually requested. If the current mode is Direct, changing DOMAIN-SUFFIX in Config alone won't make the rule take effect. Fix the routing mode first, then test On Demand separately.

Get Shadowrocket and Browse Connection Guides

The iPhone and iPad version costs $2.99 as a one-time App Store purchase. Check the App Store listing for system requirements. The Mac (Apple silicon and Intel), Windows, Android, and Linux versions are free; download the installers from this site's download page.

Download Shadowrocket