Force single region for server script

I have a server side app/docker which makes some external requests, these request needs to come from a specific region, I understand that fly routes http to the nearest proxy that’s fine as long as then the end server runs in my region. So for example:

  • User in US → fly proxy in the US → server runs in EU (FINE)
  • User in EU → fly proxy in the EU → server runs in EU (FINE)
  • User in US → fly proxy in the US → server runs in US (NOT FINE)

my server pseucode code is:
//Server side
await fetch(geoblock-rest-endpoint)if (!eu) throw`

Is there a way to force this? I know about http headers, but that’s only for the proxy no?

If that part of your pipeline also runs on fly and if it uses HTTP, you can force a specific instance by setting Fly-Replay "prefer_instance=<fly-instance-id>" HTTP header when sending a request to it.

Fly apps require you to manually create machines, we don’t create machines for you. If you only create machines in EU, no matter where the user connects from, they will be routed to a server running in EU.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.