What feature do you want?
When a list filter contains multiple values, e.g. SERVER_COUNTRIES=Poland,Germany,Czechia, treat the order of the list as a selection priority: connect to servers from the first entry, and only fall back to later entries when the earlier ones fail (connection errors / health check restarts). Today the list appears to act as a single flat pool with random pick, so there is no way to express "prefer Poland, use Germany/Czechia only as fallback".
Ideally the same semantics would apply to the other list filters (SERVER_CITIES, SERVER_HOSTNAMES, ...).
Use case
I run gluetun (ProtonVPN, WireGuard, VPN_PORT_FORWARDING=on, PORT_FORWARD_ONLY=on) on a NAS in Poland:
SERVER_COUNTRIES=Poland gives me a ~9.5 ms exit, but no cross-country failover if Polish servers have issues.
SERVER_COUNTRIES=Poland,Germany,Czechia gives resilience, but on the first connection gluetun picked a German server (~4-5x the latency) even though Polish port-forwarding servers were available.
So currently I must choose between lowest latency (single country) and resilience (pool with random exit). Priority ordering would give both.
Alternatives considered
- Single country + manual switching when it breaks.
- An external watchdog that monitors health and rewrites the server filters via the control server API, then restarts the VPN. Works, but re-implements failover logic that conceptually belongs to gluetun's server selection.
Possible shape
- Interpret list order as priority tiers: random pick within a tier, exhaust tier N before trying tier N+1 across reconnect attempts; or
- A new opt-in setting, e.g.
SERVER_SELECTION=ordered (default random for backward compatibility).
Related: #1672 (servers in the list not being tried sequentially on failure) touches the failover half of this; this request is about the list order carrying preference semantics at all.
Environment
qmcgaw/gluetun:latest (pulled 2026-07-18), VPN_SERVICE_PROVIDER=protonvpn, VPN_TYPE=wireguard, VPN_PORT_FORWARDING=on, PORT_FORWARD_ONLY=on, Docker 29.4.3 on Debian 12 (x86_64).
What feature do you want?
When a list filter contains multiple values, e.g.
SERVER_COUNTRIES=Poland,Germany,Czechia, treat the order of the list as a selection priority: connect to servers from the first entry, and only fall back to later entries when the earlier ones fail (connection errors / health check restarts). Today the list appears to act as a single flat pool with random pick, so there is no way to express "prefer Poland, use Germany/Czechia only as fallback".Ideally the same semantics would apply to the other list filters (
SERVER_CITIES,SERVER_HOSTNAMES, ...).Use case
I run gluetun (ProtonVPN, WireGuard,
VPN_PORT_FORWARDING=on,PORT_FORWARD_ONLY=on) on a NAS in Poland:SERVER_COUNTRIES=Polandgives me a ~9.5 ms exit, but no cross-country failover if Polish servers have issues.SERVER_COUNTRIES=Poland,Germany,Czechiagives resilience, but on the first connection gluetun picked a German server (~4-5x the latency) even though Polish port-forwarding servers were available.So currently I must choose between lowest latency (single country) and resilience (pool with random exit). Priority ordering would give both.
Alternatives considered
Possible shape
SERVER_SELECTION=ordered(defaultrandomfor backward compatibility).Related: #1672 (servers in the list not being tried sequentially on failure) touches the failover half of this; this request is about the list order carrying preference semantics at all.
Environment
qmcgaw/gluetun:latest(pulled 2026-07-18),VPN_SERVICE_PROVIDER=protonvpn,VPN_TYPE=wireguard,VPN_PORT_FORWARDING=on,PORT_FORWARD_ONLY=on, Docker 29.4.3 on Debian 12 (x86_64).