The Fly Runtime Environment

About

When a Fly application is running, various information about the runtime environment is made available to it.

Environment variables carry information that is generally applicable to the instance. The environment variables will also include any secrets that have been set for the application.

Request headers carry information that is specific to the incoming request and its path taken to the application. Request headers are added by the HTTP handler service.

Environment Variables

FLY_ALLOC_ID

Allocation ID: Each instance of an application running on Fly has a unique Allocation ID. This can be used, for example, to distinguish between instances running in the same region. b996131a-5bae-215b-d0f1-2d75d1a8812b is an example of the Allocation ID's format.

FLY_PUBLIC_IP

IPv6 Address for Future Access: In the future, it will be possible to address instances directly using this IP address. Currently, the address will reject all attempts to open a connection to it. Contact support@fly.io if this feature is of interest.

FLY_REDIS_CACHE_URL

URL for the Redis Cache: Each application has access to a region local Redis cache. This is the URL, complete with key, that can be used to access it with any standard Redis driver. For more on Redis see the Redis page. An example of a typical Redis URL would be redis://:InAzNmR5cW0wcjc5Z3dtZoi82aa23c663ac794ba6550f9d41d656b75579d7e1@172.18.0.1:6379.

FLY_REGION

Region name: The three letter name of the region the application instance is running in. Details of current regions are listed in the Regions page. As an example, "ams" is the region name for Amsterdam.

Request Headers

Fly-Client-IP

Client IP Address: The IP address Fly accepted a connection from. This will be the client making the initial request and as such, will also appear at the start of the X_FORWARDED_FOR addresses.

Fly-Forwarded-Port

Original connection port: This header is always set by Fly and denotes the actual port that the client connected to the Fly edge node which is then forwarded to the application instance.

Fly-Region

Edge Node Region: This header is a three letter region code which represents the region that the connection was accepted in and routed from. Not to be confused with the environment variable FLY_REGION which is where the application is running.

X-Forwarded-For

Client and Proxy List: This is a comma separated list comprising of the client that originated the request and the proxy servers the request passed through. For example, "77.97.0.98, 77.83.142.33" contains the client and the one proxy it passed through.

MDN has full documentation for this header.

X-Forwarded-Proto

Original client protocol: The protocol which the client used to make the request. Either http or https.

X-Forwarded-Port

Original connection port: This header may be set by client and should denote the port that the client set out to connect to.

X-Forwarded-SSL

SSL Status: This indicates if client connected over SSL. Its value can be either on or off.