Geo Proximity Routing: Route to the Nearest Healthy Site¶
License: pro tier and above. See Licensing. Reference: step semantics, distance/tiebreak math, and query-tracer output are in docs/reference/FilterChains.md.
prox sends every client to the nearest healthy member by great-circle
distance from the client's resolved location — the classic "GSLB routes you
to the closest datacenter" behaviour, done with member-configured
coordinates rather than guessing from a member's own IP (which doesn't work
once members sit behind RFC1918/private addresses, as most do).
If a site goes down, its clients automatically fail over to the next-nearest healthy site — there's no separate failover configuration, because distance is always computed over the currently-healthy set.
Step 1 — Configure a GeoIP database¶
prox needs the client's coordinates, resolved from a MaxMind GeoLite2-City
or GeoIP2-City database (City-level — a Country-only database can't provide
coordinates). See Regions for how to point Nexus
at a database.
Step 2 — Give every member in the pool coordinates¶
POST /api/v1/pools/{id}/members
{
"ipAddress": "10.0.1.5",
"port": 80,
"latitude": -33.8688,
"longitude": 151.2093,
"city": "Sydney",
"country": "AU",
"subdivision": "AU-NSW",
"continent": "OC"
}
latitude/longitude are required — a service using prox is rejected at
write time if any enabled member in its pool is missing them, naming the
offending member. city is display-only. country/subdivision/continent
are optional fallback tiers for the rare client that has geo data but no
coordinates — subdivision is a full ISO 3166-2 code (e.g. "AU-NSW"),
sitting between country and exact coordinates in granularity; all three are
separate from the region field geo-ip uses.
You don't need to set all three by hand — setting just subdivision fills in
country automatically (it's encoded in the subdivision code itself, e.g.
"GB-WSX" implies "GB"), and country fills in continent via the GeoIP
database, whenever the less specific field would otherwise be left empty. An
explicitly-chosen value is never overridden by this. This applies no matter
which client sets the location — gslbctl, the raw API, or the WebUI.
WebUI: the Add Member page, the topology member edit panel, and the pool detail page's inline member edit all offer a click-to-pin map for latitude/longitude (scroll or use the +/− buttons to zoom in for precision), plus chained, searchable continent → country → subdivision → city pickers — picking a continent narrows the country list, picking a country narrows subdivision/city, and so on. The choices offered come from whichever GeoIP database is actually loaded on the server, so you can't accidentally pick a country or city it can't resolve.
gslbctl:
gslbctl members add --pool <id> --ip 10.0.1.5 --lat -33.8688 --lon 151.2093 --city Sydney --country AU --subdivision AU-NSW --continent OC
Terraform:
resource "nexus_member" "sydney" {
pool_id = nexus_pool.web.id
ip_address = "10.0.1.5"
port = 80
latitude = -33.8688
longitude = 151.2093
city = "Sydney"
country = "AU"
subdivision = "AU-NSW"
continent = "OC"
}
Step 3 — Add the step to a service's filter chain¶
WebUI: open the service, switch to filter chain mode, add Geo Proximity (prox) — place it first, before a terminal selector.
API / Terraform:
The trailing weighted-round-robin only ever fires for a client prox
couldn't place at all (unlocatable, or no coordinates and no country/
continent match) — it gives that rare case the pool's normal weighted
rotation instead of a fixed arbitrary member. A located client's answer is
decided entirely by prox.
Step 4 — See it working¶
- Query tracer (
gslbctl trace <service-id>or the WebUI trace panel) shows each candidate's distance in km, nearest first. - Multi-answer: set
maxAddrsReturnedon the service to get more than one answer per query —proxproduces a fully-ordered list, so the first N are returned nearest-first (see Multi-Answer Responses).
Notes¶
- Distance ties within 10km of each other are broken by member weight (higher wins) — otherwise distance alone decides, even against a much-higher-weight but clearly farther member.
- A member without coordinates is simply excluded from the distance
ranking — config validation normally prevents this by requiring every
enabled member in a
proxpool to have them. - IPv6 clients are fully supported for matching; members are IPv4-only
(unchanged Nexus-wide constraint, not specific to
prox).