How can I tell which region a fly app is being served from?

hi there,

When I receive a request to my application, I’d like to be able to expose the fly region I am serving the response from, and ideally figure out a way to serve the carbon intensity of the energy it’s using.

So if I am in say New York, and I am running an application in Montreal, I’d want to be able to surface that it’s being served from a Montreal datacentre, where the energy has a much lower carbon intensity than than other parts of North America.

(let’s put aside issues about latency for now - I use montreal as an simple example)

Is there a native way to do this?

I think that in my own application, I could look for the FLY_REGION environment variable exposed to my app, then add something like a Via header to my own HTTP response, but it wasn’t clear to me whether this was already being done, or if I’d need to roll my own solution for my own apps.

You can see more abot the FLY_REGION variables below:

To answer your question, the Fly proxy does not expose the allocation region, but it does expose the edge region where the request was picked up. So, like you said, you would have to roll your own solution for that part.