I’m preparing a small Python/Gunicorn HTTPS webhook receiver on a single Fly Machine.
Before deployment, I’d like to confirm the recommended security boundary between Fly Proxy and the application.
Could you clarify:
Can applications reliably identify Fly Proxy connections using the socket’s REMOTE_ADDR? Are there documented, stable addresses or ranges for this purpose?
Can another Fly Machine or private-network client connect using the same apparent source addresses?
Can these addresses change following a restart, migration, or infrastructure update?
What is Fly.io’s recommended approach to verifying that a request arrived through the legitimate HTTPS proxy, rather than trusting potentially spoofed forwarded headers?
My intended receiver will also require a separate application-level authentication token. I want to configure proxy validation correctly without depending on undocumented network assumptions.
You don’t need to rely on REMOTE_ADDR or proxy address ranges. They aren’t published as a stable trust boundary, and they can change.
Use the headers Fly Proxy adds instead. With handlers = [“tls”, “http”] on your service, Fly Proxy terminates TLS and sets Fly-Client-IP on every request to the real client IP. It overwrites any value the client sends, so it can’t be spoofed. X-Forwarded-For is also set: the proxy appends the client IP and then your app’s public IP, so the second-to-last entry is trustworthy and anything before it is client-supplied.
In your app, read request.headers[“Fly-Client-IP”]. You don’t need Gunicorn’s forwarded_allow_ips, which only affects REMOTE_ADDR/scheme handling.
To keep other Machines on your private network from reaching Gunicorn directly and bypassing the proxy, bind to 0.0.0.0:<port> rather than [::]. Private networking is IPv6-only, so an IPv4-only bind is reachable only through Fly Proxy.
For webhooks specifically, I’d also recommend verifying the sender’s signature (HMAC or similar) rather than relying on IP alone.
Thank you so much for the detailed explanation! This is extremely helpful and resolves the main security concern we had before deploying.
We’ll follow your recommendation to bind Gunicorn to IPv4 (0.0.0.0), use Fly Proxy’s TLS/HTTP handlers, and maintain separate application-level webhook authentication.
Just two final clarifications:
Direct-access protection: Is binding exclusively to IPv4 sufficient to prevent other Fly Machines from bypassing the proxy and injecting spoofed Fly-Client-IP headers? Are any additional Fly.io configuration controls recommended?
Webhook authentication: Our data provider is TradingView, which doesn’t provide a straightforward way to attach a custom HMAC signature to its standard alerts. We’re planning to use a high-entropy, rotating authentication token inside the HTTPS JSON payload, along with strict validation and replay/duplicate protection. Would you recommend any additional security precautions for this use case?
We’re building a small, security-conscious Python webhook service and want to establish the correct architecture from the beginning.
Hi, for #1, only Fly machines within your organization can talk to each other over the org-wide IPv6 network - if that doesn’t reduce the attack surface sufficiently, you can set your app up in its own private subnet (https://docs.fly.io/networking/private-networking), that way nothing can talk to it but other machines in the same app.
For #2, something in the payload sounds reasonable to me, but only you can detemine if this security is sufficient for your use case.