Shadowrocket On Demand Setup: Automate VPN Connections by Wi-Fi, Cellular, and Domain

Set Shadowrocket to connect or disconnect automatically based on your network or the domains you visit. Learn how to configure Wi-Fi SSID, cellular, and domain triggers, plus common combinations.

At a glance

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.

Network or lookupCondition matchConnection decisionTunnel establishedTraffic routing
2 levels
Settings path: Settings → On Demand
2 types
Network interfaces covered: Wi-Fi and cellular
4 checks
Global Routing:Config / Proxy / Direct / Scene

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.

  1. 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.
  2. 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-5G and Home-Guest are different names. A rule for the main network won’t cover the guest network just because both use the same router.
  3. 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.
  4. 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 whether Home connects 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 in Home during 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.

[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 Routing to Config, 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.

Download Shadowrocket for all platforms