Shadowrocket On Demand: Auto-Connect by Domain
What you want to do
Have Shadowrocket connect by itself when you visit certain sites, instead of going back to the Home tab and turning on the switch every time.
Where to set it
Settings tab › On Demand. The option names and notes below come from the US App Store screenshots.
| Option | Note in the screenshot | Meaning |
|---|---|---|
| On Demand | Toggles VPN On Demand. | Turns On Demand on or off |
| Network | On Demand rule network interface types | Which networks the rules apply on; the screenshot shows Any |
| Disconnect on Sleep | If YES, the VPN connection will be disconnected when the device goes to sleep. The default is NO | When on, the connection drops when the device sleeps; off by default |
| Show Disconnect Message | — | No note in the screenshot; untested |
| Add Domain | — | Adds a domain to the rule list below |
How rules match
The note under the rule list says a rule matches when the host name of the destination being connected to shares a suffix with one of the entries. So if you add example.com, visiting www.example.com or a.example.com matches (an example domain, not a real site).
- Open the Settings tab and go to On Demand.
- Under Add Domain, enter a domain, for example
example.com. - Turn on the On Demand switch.
- Visit a site on the list and see whether Shadowrocket connects automatically (behavior untested).
What to watch out for
- It only decides when to connect: once connected, where your traffic goes is still up to your config file and rules.
- Battery and data: automatic connections mean it may be on without you noticing. Turn the switch off when you don’t need it.
- If it won’t connect: turn On Demand off, connect manually once to check the server works, then see Shadowrocket not connecting.
- It may reconnect on its own: On Demand uses iOS’s VPN On Demand feature. Once it’s on, the system connects automatically according to the rules, so after you disconnect manually it may connect again. If you don’t want that, turn off the On Demand switch first. Exact behavior is untested.