Referencing a specific region via DNS?

Not sure if this is possible. It would be really useful to be able to reference a container running in a specific region. E.g. If I’m in London and I have an app with 3 instances, running in:

  • lhr
  • lax
  • nrt

And I wanted to test something in the LAX region (latency or similar), being able to connect to something like Otherwise I’m having to VPN to somewhere closer to LA than London…?

There are a couple ways to achieve something close to this:

  • You can reach your instances directly (not going through our proxy) by connecting via wireguard and using <region>.<app>.internal
  • You can use the fly-prefer-region header in your request to ask our proxy to prefer a region when load balancing (this will not affect which edge location you connect to, only where your request goes next)

If you want to test connecting to our edge location, you will need to VPN somewhere close to the region you’re aiming for (but there are no guarantees).

Unfortunately, the way anycast IPs work, we’d need IPs announced only in certain regions. We’re actually working on this, but it wouldn’t be automatic. You’d have to assign an IP in a specific region and then you could use a hostname, similar to what you suggested, to reach your app.

What are you trying to measure?

  • Latency between a user in a specific region and your app: VPN or synthetic tests (datadog, pingdom, grafana, gcp, etc.). The latter are not to be relied on as a real-world representation though, they go through big internet pipes not available for end-users.
  • Latency between your app in a specific region and you: fly-prefer-region header.
  • Latency between your app and anything: flyctl ssh console --select and choose the region you’re interested in. There you can run whatever command.

You could use the replay header to let users pick a region like this demo application:

If you can read ruby, this is how it works: global-rails/dashboard_controller.rb at main · fly-apps/global-rails · GitHub

1 Like

Thanks for the answers!