How to retreive the real ip address of an http request with v2 app with http_service configuration

Hi there,

I have a docker image deployed as a v2 app that receives http traffic using the [http_service] configuration. I would like to derive the real ip address of any requests I receive to this app. Currently I am looking at the X-Forwarded-For header and taking the last address in the comma delimited string but I believe this approach depends on whether this traffic is coming through a reverse proxy and probably some other considerations? Is there any documentation or is anyone able to outline what the correct approach is for acheiving this?


If the context helps, my hope is to use this derived ip address to apply rate limiting on requests.

We provide a Fly-Client-IP header you can use for this purpose: The Fly Runtime Environment · Fly Docs

It’s not actually possible to hit your service port directly, so it’s safe to use this header for an app running behind our proxy.

1 Like

Ah that’s perfect, thanks for the quick response!

In my experience, it’s HTTP_FLY_CLIENT_IP instead.


As pointed out by @enigmatix, the header is HTTP_FLY_CLIENT_IP not Fly-Client-IP

From How To to Questions / Help

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