At a glance

Shadowrocket’s On Demand system controls when the VPN tunnel connects or disconnects; it does not replace routing rules for traffic after connection. This guide is for users with their own provider and subscription who can already connect manually. Start with simple rules for Wi-Fi and cellular, test domain-based triggers separately, then check rule priority and system permissions. A connected VPN does not mean all requests use a proxy.

First, distinguish On Demand from Global Routing

Find On Demand under Settings → On Demand. It uses the system VPN mechanism to apply connection conditions, which can include network interfaces, Wi-Fi names, and domain evaluation. It is not a timer, and it does not rely solely on whether Shadowrocket is in the foreground. Automatic connections still require a valid VPN configuration, system permission, and an available network.

Global Routing controls how requests are handled after the tunnel is established. In Home, Global Routing offers options such as Proxy, Direct, Config, and Scene; Config routes traffic according to the rules in the selected configuration. Connect in On Demand does not switch Global Routing to Proxy, and Disconnect does not switch it to Direct. Check these two layers separately when troubleshooting.

Network conditions change On Demand conditions match The system establishes the tunnel Request rules select a route The outbound policy is applied

For example, after a cellular rule triggers Connect, requests matching DIRECT still connect directly if Global Routing is set to Config; only requests matching a proxy policy use the corresponding outbound. Conversely, a DOMAIN-SUFFIX rule in the configuration does not mean the tunnel will connect automatically when that domain is accessed.

2 layers
Check tunnel connection conditions separately from request routing after connection
3 steps
Settings → On Demand → Check conditions and actions
1 change
Change one condition per test so results are easy to compare

Check the tunnel first, then the outbound route

If automatic connection does not occur, check On Demand first. If the system shows a connection but requests take the wrong route, check Global Routing and Config. Avoid changing unrelated settings.

Before enabling automation: establish a manual-connection baseline

Automation rules cannot fix an invalid connection configuration. Before you begin, select an existing configuration in Home, connect manually, confirm that the system allows a VPN configuration to be added, and access a destination you actually need. A subscription provides and updates existing connection details; it does not determine Wi-Fi conditions or domain triggers for you.

  1. Record the current setup: Note the selection in Home, the Global Routing option, and the configuration currently in use under Config. Also record the order and actions of any existing On Demand rules.
  2. Verify connectivity: Connect manually on the Wi-Fi and cellular networks you plan to test. If the connection does not work on either network, resolve the network or existing configuration issue first.
  3. Open the settings: Go to Settings → On Demand and review the network conditions, actions, and rule order. Controls and available conditions may vary; use what appears in the current app rather than relying on an old guide to locate a specific button.
  4. Check system settings: In iPhone or iPad Settings, find the VPN configuration and check the one associated with Shadowrocket, including its Connect On Demand status. The exact system path and labels may vary by device.
  5. Test one condition at a time: Enable only the network-condition rules first, without adding domain evaluation. Once network switching behaves as expected, add another type of condition.

Set actions for Wi-Fi names and cellular networks

Define the intended behavior first. For example, disconnect the tunnel when connected to a Wi-Fi network named Home-WiFi, and connect it when switching to cellular. Home-WiFi is only an example of a custom network name. Replace it with the SSID of a network your device actually uses; do not copy a name that does not exist.

Check the SSID against the actual network name, including capitalization, spaces, and punctuation. Multiple access points with the same name may match the same condition, and an SSID alone cannot establish that a network is trusted. If your work and home networks share a name, the SSID cannot distinguish between them.

Specific Wi-Fi condition

Location
Settings → On Demand
Interface
Wi-Fi
SSID example
Home-WiFi; enter the actual network name
Action
Disconnect
Order
Place it before the general Wi-Fi condition

Use Disconnect only if you want the tunnel to stay off on that network; this does not assess whether the network is secure.

Cellular condition

Location
Settings → On Demand
Interface
Cellular
SSID
Does not apply to cellular interfaces
Action
Connect
Test
Turn off Wi-Fi and make a new request

This does not apply to iPads without cellular capability. When connected to a personal hotspot, the receiving device typically uses the Wi-Fi interface.

  1. Add an SSID condition for the specified Wi-Fi network and select Disconnect. After saving, verify that the condition is tied to Wi-Fi rather than being a general rule with no interface restriction.
  2. Add a Connect condition for Cellular. Make sure cellular data is available; turning off Wi-Fi without cellular data does not provide a valid connectivity test.
  3. To connect automatically on other Wi-Fi networks too, add a Connect condition for those networks and place it after the specific-SSID exception.
  4. Reconnect to the target Wi-Fi, then switch to cellular and make one new request on each network. Record the network name, expected action, and actual VPN status shown by the system.

When switching networks, an existing connection, the interface being switched to, and system timing can affect what you observe. Do not treat the icon immediately after a switch as the final result. Wait until the network is available, then check VPN status and make a new request. Avoid testing rules by switching rapidly back and forth.

Triggering connections by domain: don’t move DOMAIN-SUFFIX into On Demand

Domain-based On Demand and ordinary domain routing serve different purposes. The system uses domain-related connection evaluation to decide whether a tunnel is needed; routing rules choose a policy for requests while the tunnel is active. Apple’s On Demand mechanism can handle this with EvaluateConnection and its domain evaluation actions. ConnectIfNeeded evaluates whether a connection is needed; it does not connect unconditionally every time a particular website is opened.

In Settings → On Demand, check whether the current interface offers domain evaluation and a corresponding action. If available, enter a domain, such as internal.example.com, not https://internal.example.com/path. This example only demonstrates the input format; it is not a working internal service. For testing, use a domain you are authorized to access and whose DNS behavior you understand.

“Connect on any Wi-Fi” and “connect only when a particular domain is needed” are different goals. The first establishes a tunnel as soon as the network condition matches, so a later domain condition cannot narrow it down. To connect by domain, check whether a general network rule matches first and prevents domain evaluation.

Domain rules in Config handle traffic after connection

The following example uses Config rule syntax; it is not On Demand configuration text. It specifies a policy for matching requests, not a system trigger for automatic connection.

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

With Global Routing set to Config, the first rule sends requests matching the relevant domain to PROXY, while other requests fall through to FINAL and DIRECT. Make sure PROXY maps to a working outbound in the actual configuration. Saving this rule to Config does not set up domain-based On Demand connections.

When multiple conditions match: check rule order first

The system evaluates On Demand rules in order. The first matching rule determines the action for that evaluation; actions are not all applied together. More specific exceptions generally belong before broader network conditions. Check conditions within domain evaluation rules separately, and do not confuse their order with the rules in Config.

OrderMatching conditionActionWhat to check
1Wi-Fi with SSID Home-WiFiDisconnectPlace the specific-name exception before general Wi-Fi
2Other matching Wi-Fi networksConnectEvaluated only if the first rule does not match
3CellularConnectTest while cellular data is available

This table shows a network-priority setup and does not include domain evaluation. If you move the general Wi-Fi Connect rule to the top, Home-WiFi will match it too, preventing the later Disconnect rule from working as an exception. If you add a general condition with no interface restriction, check that it does not prevent all subsequent network rules from being evaluated.

  1. When the result is unexpected, start with the first rule and note for each one: “Does the current interface match? Does the SSID match? What is the action?”
  2. Temporarily disable newly added rules and keep the smallest set that worked before. Check whether the issue disappears when the new conditions are removed.
  3. Change the position or action of just one rule at a time. Save, then test network switching and make a new request again.

Config’s FINAL rule cannot fix On Demand rule order. FINAL is a fallback for request routing; it is not a fallback connection action for system On Demand and cannot correct an incorrect SSID condition.

Troubleshooting: no automatic connection, reconnects after disconnect, or no domain trigger

Start by recording a reproducible sequence: the networks you switched between, the selected configuration, the first matching condition, and the system VPN status. Use the checks below for the symptom you see; there is no need to reset everything at once.

On Demand is enabled, but it does not connect after switching to cellular?

First confirm that cellular data works, then open Settings → On Demand and check the Cellular condition and Connect action. Look for an earlier general Disconnect rule. Next, check Connect On Demand in the system VPN configuration. If manual connection also fails, troubleshoot the existing connection configuration first.

Why does it connect again after I disconnect it manually in Home?

If On Demand is still enabled, a later network event or request may meet the connection conditions again. To test a pause, turn off On Demand in Settings → On Demand before disconnecting manually, then check the status of the corresponding system configuration. Do not keep toggling the connection switch in Home.

Why does it still show as connected when Disconnect is set for a specific Wi-Fi network?

Check the actual SSID, especially trailing spaces and similar-looking characters, and make sure the specific SSID rule comes before the general Wi-Fi Connect rule. Then verify that the system is showing the VPN configuration associated with Shadowrocket, not the connection status of another configuration.

Why didn’t visiting the domain trigger a connection? Is the domain wrong?

First make sure you entered a domain, not a full URL. Then check whether an earlier network action ended the evaluation. If you use ConnectIfNeeded, also check whether DNS on the direct network already satisfies the condition and whether the test app reused a connection. Do not try to fix a system trigger by repeatedly adding DOMAIN-SUFFIX rules to Config.

Why do some requests still connect directly after automatic connection succeeds?

Go back to Home and check Global Routing. With Config, review the matching policy for each destination and the FINAL rule. With Direct, requests will not switch to a proxy just because On Demand triggered Connect. Identify the policy matched by the request first, then check whether the existing outbound is available.

To roll back, turn off On Demand first, return to manual connections, and confirm the baseline still works before restoring rules one at a time. For everyday use, keep the smallest set of rules that explains each result. Avoid masking problems with overlapping, duplicate conditions.