I have a doubt about internal request routing.
Say I have 3 openresty instances which proxy to 3 varnish instances, spread across 3 regions. Varnish proxies to a Rails app.
Under normal circumstances, openresty should route to its region-local varnish pair. That can be done using the
current_region.varnish.internal address. What happens if the current region’s varnish is unhealthy?
If the answer is that no IPs would be returned, would it smart to get all healthy records from
varnish.internal and ensure the regional one is weighted first?
Naturally, my next question: could this logic could be handled somehow by service discovery directly? If not, I suppose it could be generalized into a script that returns the correctly ordered IPs.