On iPhone and iPad, first confirm that Shadowrocket connects manually from Home, then set up automation under Settings → On Demand. Test Wi-Fi or cellular conditions individually before trying domain conditions. On Demand controls whether a VPN connection is established; Global Routing controls how traffic is routed after connecting. Check them separately. On Mac, Windows, Android, and Linux, follow the options available in each platform’s interface.
What On Demand and Global Routing control
When you switch networks, the system can use On Demand conditions to decide whether to start or disconnect the VPN. Once the VPN is connected, Shadowrocket routes traffic entering the tunnel. When testing, check the connection status in Home first, then check the result of your visit. Don’t use whether a webpage loads as a substitute for checking the connection status.
If connected but traffic is routed incorrectly, check routing first
If Home shows a VPN connection after switching networks, set Global Routing to Config, then open Config to confirm which configuration is active. Changing the SSID won’t change which domain-based routing rule matches.
Set up automatic connections by Wi-Fi SSID and cellular network
For example, you may want the VPN to disconnect at home and connect automatically on cellular when you leave. Decide how to handle Wi-Fi networks outside your home first. Setting conditions for your home SSID and cellular alone does not make the VPN connect on all other Wi-Fi networks.
- Test a manual connection. In
Home, select an existing server entry and connect manually. Allow Shadowrocket to add a VPN configuration if prompted. Confirm that you can reach the intended destination, then disconnect before testing automation. If you use a subscription, get it from your service provider. - Note your home SSID. In system
Settings → Wi-Fi, check the name of the connected network and enter it exactly as shown, including capitalization, spaces, and suffixes. For example,Home-5GandHome-Guestare different names. A rule for the main network won’t cover the guest network just because both use the same router. - Save both conditions. Open Shadowrocket
Settings → On Demand, pair your exact home SSID with a disconnect action, and pair the cellular network with a connect action. If the current interface supports ordering and a general Wi-Fi condition, put the specific SSID condition before any general Wi-Fi condition that could also match. Don’t add a condition that applies to all networks yet. - Test the transition in both directions. On your home Wi-Fi, confirm that the VPN disconnects. Turn off Wi-Fi in system
Settings → Wi-Fi, confirm that cellular data is available, then visit a webpage and check whetherHomeconnects automatically. Turn Wi-Fi back on, wait for the device to reconnect to the same SSID, and check whether the VPN disconnects. Don’t manually toggle the connection inHomeduring the test.
A domain trigger doesn’t mean only that domain is proxied
If your current On Demand interface offers a condition that evaluates connections by domain, test it first on a network where no other condition will connect or disconnect the VPN. Enter the hostname you actually want to visit, such as portal.example.com. Don’t include https://, a port, or a path, and don’t paste a full DOMAIN-SUFFIX rule into the domain field. The example domain illustrates the format; use a real test destination you can access when verifying.
- Make a fresh lookup. Visit the test host while the VPN is disconnected. An open page may reuse a connection or cached DNS result, and apps with their own encrypted DNS may not use the system’s domain evaluation path. For the first test, try a reachable host that hasn’t been looked up yet instead of repeatedly refreshing the same page.
- Configure the trigger and routing separately. A domain trigger only helps decide whether to connect. To proxy only specific domains after connecting, add the following routing rules to the active configuration and set
Global RoutingtoConfig.DOMAIN-SUFFIXmatches the specified domain and its subdomains;FINALhandles requests that didn’t match an earlier rule. - Closing a webpage doesn’t disconnect the VPN. A domain trigger isn’t tied to a browser tab’s lifetime. If the VPN stays connected after you close a page, that doesn’t mean the condition is misconfigured. To disconnect when you return to a particular network, set a separate disconnect action for that network.
[Rule]
DOMAIN-SUFFIX,portal.example.com,PROXY
FINAL,DIRECT
This is a minimal routing example, not text to import into On Demand. When editing an existing configuration, put specific domain rules before broader rules that might match first, and keep one FINAL rule at the end. If your current platform has no domain-trigger option, use a network condition to start the VPN, then use Config to control which domains are proxied. This does not trigger a connection by domain.
Two common condition combinations
The cards below describe the behavior to configure; they are not ready-to-paste configuration text. Test one setup at a time. If you use both automatic cellular connection and domain triggers, the VPN may connect on cellular before you visit the target domain.
Disconnect on home Wi-Fi, connect on cellular
- Home SSID
Home-5G; disconnect when matched- Cellular network
- Connect on demand after switching to cellular data
- Other Wi-Fi networks
- Don’t add a general action during initial testing; observe what happens
- Test sequence
- Home Wi-Fi → cellular → the same home Wi-Fi
If you also have a guest network or a second home network name, check each one to see whether it should also disconnect the VPN.
Evaluate the connection when visiting a specific host
- Requirement
- The current interface offers domain-trigger conditions
- Test host
portal.example.com; enter the hostname only- Test network
- Make sure no general connect or disconnect condition matches first
- After connecting
- Set
Global RoutingtoConfig, then check the rule for that domain
Start with the VPN disconnected and visit the host, then compare with a host that doesn’t meet the condition. This helps avoid mistaking an existing connection for a successful trigger.
Troubleshoot failed automatic connections and unexpected reconnects
Why doesn’t the VPN disconnect when I get home?
First, confirm in system Wi-Fi settings that you’re connected to the exact SSID specified in the configuration. Then open Settings → On Demand and check that the condition is saved with a disconnect action. If there’s a general Wi-Fi connect condition, temporarily remove it or move the specific SSID condition above it, then test again by switching from cellular to your home Wi-Fi.
Wi-Fi is off, but the VPN didn’t connect automatically. What should I check?
First, confirm that the device has switched to usable cellular data and isn’t still connected to Wi-Fi. Then check that the cellular condition is set to connect. While on cellular, try connecting manually from Home. If that fails too, troubleshoot cellular connectivity or the server before changing the rule order repeatedly.
Why didn’t visiting a specific domain trigger a connection when it works manually?
Check that you entered the hostname the browser actually visits, especially if the login hostname changes after a redirect. Test again with an uncached host that meets the condition, and rule out any earlier disconnect condition. If DOMAIN-SUFFIX only matches after you connect manually, you’ve verified routing, not an On Demand connection trigger.
How can I temporarily stop the VPN from reconnecting after I disconnect it in Home?
Turn off On Demand under Settings → On Demand first, then disconnect from Home. Disconnecting the current session alone may not disable saved trigger conditions. When you turn On Demand back on, verify the expected action with a known network switch.