English
reload — connections on reload
A reload (by SIGHUP, --watch, from the dashboard, after a subscription update) does not restart the process: components whose settings did not change keep running, the others are rebuilt. Live connections are then checked against the new rules and handled according to the policy.
yaml
reload:
connections: reroute_changed| Policy | What happens to a connection |
|---|---|
reroute_changed (default) | If under the new configuration the connection would go to another outbound, or its outbound was rebuilt: TCP is closed, a UDP flow is moved to the new outbound. Otherwise it stays |
keep | Stays on the outbound it was opened through, even if that outbound is no longer in the configuration |
close | Is closed |
"Another outbound" takes groups into account: if a group changed its chosen member, the connection also counts as rerouted. A reload that neither changes a connection's route nor touches its outbound does not affect the connection under any policy except close.
The same check runs when a remote or file rule-set changes: only connections whose route depended on that set are affected.
A policy for some of the connections
The section sets the default. It can be overridden:
| Where | How |
|---|---|
| On an inbound | The inbound's reload block — reload |
| On an outbound or group | The reload block of the outbound or group |
| On a rule | The reload field in do: options |
Priority: the rule, then the outbound (first the final outbound, then the groups through which it was chosen, from the inside out), then the inbound, then the reload section. The settings of the new configuration are taken into account.
yaml
inbounds:
local:
mixed:
listen: 127.0.0.1:1080
reload: keep
outbounds:
direct:
direct:
proxy:
socks:
server: 192.0.2.10:1080
reload: close
route:
rules:
- match:
domain_suffix: bank.example
do:
options:
reload: keep
- match:
domain_suffix: bank.example
to:
outbound: proxy
final:
outbound: direct
reload:
connections: reroute_changedHere connections to bank.example survive any reload: the rule takes precedence over the policy of the proxy outbound. Any other connections through proxy would be closed on every reload. Connections of the local inbound through direct stay in place by the inbound's policy.
What is visible
After a reload the log says how many components changed and how many connections were closed and kept. ours check --diff new.yaml -c current.yaml shows in advance which components will be rebuilt; before applying, the dashboard also shows an estimate for the connections.