This guide is for users who have already connected manually with Shadowrocket on an iPhone or iPad. Use Settings → On Demand to distinguish home Wi-Fi from cellular, then check whether domain conditions trigger an automatic connection. If rules conflict, first check whether the system started the tunnel, then go to Home → Global Routing to see how traffic is handled after connecting.
On Demand controls when to connect; Global Routing controls where traffic goes
On Demand is the system VPN’s on-demand connection mechanism. When the network interface changes, the system reevaluates the applicable network rules. If a rule evaluates domains, it may also wait for a qualifying DNS lookup. Global Routing determines how requests are handled once the tunnel is established. With Config selected, requests are routed according to the chosen configuration. DIRECT in a configuration sends a request directly; it does not tell the system to turn off the tunnel.
Keep the server fixed while testing network changes
In Home, connect manually to the same server and confirm that a test webpage loads. Then disconnect and enable On Demand. Don’t switch servers or routing modes during the test; this makes it easier to tell a connection failure from a trigger failure.
Disconnect on Wi-Fi; connect on cellular
The example goal is to turn off the tunnel when you get home and connect automatically over cellular after leaving Wi-Fi. In your system’s Wi-Fi settings, check the actual SSID you’re connected to—the network name. Don’t enter the router model, a local network address, or your phone’s name. Home-WiFi below is only an example; enter the name shown on your device, including spaces and capitalization. If your guest network has a different name, treat it as a separate match condition; don’t assume it matches along with the main network.
Home Wi-Fi exception
- Interface
- Wi-Fi
- SSID
Home-WiFi- Action
Disconnect
Matches this name only. If you have a general Wi-Fi connection rule, put the exception before it.
Connect on cellular
- Interface
- Cellular
- SSID
- Leave blank
- Action
Connect
Test on a device that supports cellular data. Having a cellular signal doesn’t mean the system is using the cellular interface.
- Go to
Settings → On Demandand set the home Wi-Fi exception and cellular action using the network conditions available in your current interface. If Wi-Fi exceptions are managed in a single list, add theSSIDas directed by the list instead of adding a general rule that overrides the exception. - Save and enable
On Demand. Keep cellular data available, then turn off Wi-Fi inSettings → Wi-Fito prevent the device from joining another saved network nearby. Open a test webpage, then return toHometo check the connection status. - Turn Wi-Fi back on, confirm that you’re connected to your home network, then check the connection status. The expected behavior is to connect over cellular and disconnect when you return to a matching Wi-Fi network. If the tunnel stays connected at home, first check the
SSIDand rule order, then check which VPN configuration is currently active in the system.
To save cellular data, do the opposite: set the cellular condition to Disconnect and make sure no broader connection rule matches first. Don’t keep conflicting default actions for the same interface. An iPad without cellular data can test the Wi-Fi exception, but not cellular rules.
Domain triggers: they match DNS lookups, not URL paths
Domain-based triggers behave differently from connecting immediately based on the network interface. If your current On Demand screen offers domain evaluation, first route the target network through the EvaluateConnection branch, then configure the domains and actions for that branch. If the only options are to connect or disconnect based on the network, don’t treat domain rules in Config as system triggers: they only affect Shadowrocket routing after the tunnel is established.
- Enter a domain, not a URL. Use
example.comas a format example. Don’t include a scheme, port, path, or query parameters. To distinguish services, test the actual hostname being requested; redirects, sign-in pages, and static assets may use different domains. - Know what each evaluation action does. In system rule semantics,
ConnectIfNeededmeans connect on demand, not force a connection on every visit. For example, the tunnel may not start if the current network can resolve the domain successfully and no additional probe is required.NeverConnectmeans not to initiate a connection because a domain matched; visiting that domain alone won’t tear down an existing tunnel. - Test from a disconnected state. On a network where domain evaluation should match, make sure the tunnel is disconnected, then issue a request that requires a fresh DNS lookup and see whether the tunnel starts. Simply refreshing an open webpage may reuse cached DNS or an existing connection, so it won’t show that the domain rule is broken. Accessing a site by IP address won’t test a domain trigger either.
If you want the tunnel to stay connected while sending a particular site’s traffic directly, set up routing in Config. For example, DOMAIN-SUFFIX,example.com,DIRECT sends requests matching that domain suffix directly. Select Global Routing → Config to apply the rule from the chosen configuration. This does not replace the On Demand disconnect action.
Rule conflicts: put specific conditions before general actions
The system evaluates On Demand network rules in order and uses the first match. It won’t go back and use a later, more specific SSID rule. If the editor lets you reorder rules, put the home Wi-Fi exception before general Wi-Fi rules. If two rules could match the same interface—for example, a general cellular Connect rule and a cellular-only EvaluateConnection rule—decide whether that interface should connect immediately or wait for domain evaluation. Don’t let an immediate-connect rule override the evaluation branch.
- Handle exceptions first. Start with networks that must disconnect, such as
Wi-Fi + Home-WiFi → Disconnect. - Limit where domain evaluation applies. If you only want to evaluate domains on a specific test Wi-Fi network, restrict the rule to that network and put it before general Wi-Fi actions.
- Set defaults for the remaining networks last. Decide separately what should happen on cellular and other Wi-Fi networks. If you add a fallback rule with no interface restrictions, put it last so it doesn’t override earlier exceptions.
- Retest each rule. Record the actual network, expected action, and status shown in
Home. Change one rule at a time and retest under the same network conditions, then switch to another interface to make sure the change hasn’t affected existing rules.
Common issues: reconnecting automatically, cellular rules not triggering, and domain rules not matching
Why does it reconnect when I open a webpage after disconnecting manually?
Go back to Settings → On Demand and check that the feature is still enabled. To stay disconnected temporarily, turn off on-demand connections before disconnecting in Home. To disable it only at home, leave the main switch on and check whether the current Wi-Fi matches your disconnect exception.
Why doesn’t my phone connect automatically after I leave home?
Turn off Wi-Fi in system settings. First, use cellular data to open a page that normally works without a tunnel and confirm that mobile data is available. Then check that the cellular condition is set to Connect. If a manual connection fails too, check whether the selected server is available. Get server settings from your service provider.
Why doesn’t visiting a specific site trigger the tunnel?
First confirm that the current interface matches the domain evaluation branch rather than an earlier general action. Then check that you entered a domain, not a full URL. With ConnectIfNeeded, it may be expected for the tunnel not to start if the domain resolves on the current network.
The tunnel is connected, but webpages won’t load. What should I check first?
First note the current mode under Home → Global Routing. If Config is selected, check which rule and policy match the target host, then check DNS resolution and server connectivity separately. A connected status only confirms that the tunnel is established; it doesn’t mean every request is proxied or that the destination site is reachable.