# Security guidance: verifying Fly Proxy socket peers and forwarded headers

**URL:** <https://community.fly.io/t/security-guidance-verifying-fly-proxy-socket-peers-and-forwarded-headers/28891>\
**Category:** Questions / Help\
**Tags:** security, proxy\
**Created:** [October 21, 2026, 3:18pm UTC](https://community.fly.io/t/security-guidance-verifying-fly-proxy-socket-peers-and-forwarded-headers/28891 "2026-10-21T15:18:26Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![gem-ai-builder](https://avatars.discourse-cdn.com/v4/letter/g/858c86/32.png) [@gem-ai-builder](https://community.fly.io/u/gem-ai-builder)\
**Post date:** [October 21, 2026, 3:18pm UTC](https://community.fly.io/t/security-guidance-verifying-fly-proxy-socket-peers-and-forwarded-headers/28891/1 "2026-10-21T15:18:26Z")

</div>

Hello [Fly.io](http://Fly.io) team,

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:

1. Can applications reliably identify Fly Proxy connections using the socket’s `REMOTE_ADDR`? Are there documented, stable addresses or ranges for this purpose?

2. Can another Fly Machine or private-network client connect using the same apparent source addresses?

3. Can these addresses change following a restart, migration, or infrastructure update?

4. What is [Fly.io](http://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.

Thank you for your guidance!

---

<div class="post-metadata">

**Author:** ![flyio-support](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/flyio-support/32/46245_2.png) [@flyio-support](https://community.fly.io/u/flyio-support)\
**Post date:** [October 21, 2026, 4:57pm UTC](https://community.fly.io/t/security-guidance-verifying-fly-proxy-socket-peers-and-forwarded-headers/28891/2 "2026-10-21T16:57:59Z")

</div>

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.

Docs: [https://fly.io/docs/networking/request-headers/](https://fly.io/docs/networking/request-headers/)

---

<div class="post-metadata">

**Author:** ![gem-ai-builder](https://avatars.discourse-cdn.com/v4/letter/g/858c86/32.png) [@gem-ai-builder](https://community.fly.io/u/gem-ai-builder)\
**Post date:** [October 21, 2026, 6:35pm UTC](https://community.fly.io/t/security-guidance-verifying-fly-proxy-socket-peers-and-forwarded-headers/28891/3 "2026-10-21T18:35:00Z")

</div>

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:

1. **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](http://Fly.io) configuration controls recommended?

2. **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.

Really appreciate your help and guidance!

---

<div class="post-metadata">

**Author:** ![flyio-support](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/flyio-support/32/46245_2.png) [@flyio-support](https://community.fly.io/u/flyio-support)\
**Post date:** [October 21, 2026, 6:39pm UTC](https://community.fly.io/t/security-guidance-verifying-fly-proxy-socket-peers-and-forwarded-headers/28891/4 "2026-10-21T18:39:16Z")

</div>

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](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.

---

<div class="post-metadata">

**Author:** ![lillian](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/lillian/32/49616_2.png) [@lillian](https://community.fly.io/u/lillian)\
**Post date:** [October 21, 2026, 6:43pm UTC](https://community.fly.io/t/security-guidance-verifying-fly-proxy-socket-peers-and-forwarded-headers/28891/5 "2026-10-21T18:43:55Z")

</div>

> [@gem-ai-builder](#):
>
> 1. Is binding exclusively to IPv4 sufficient to prevent other Fly Machines from bypassing the proxy and injecting spoofed `Fly-Client-IP` headers?

yes. fly-proxy exclusively connects to your app using IPv4. Fly Machines can only talk to other Machines using IPv6.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/fly1/original/3X/6/e/6e8955d00cb218e186ebbe3a6ab06fefdce15290.svg) [@system](https://community.fly.io/u/system)\
**Post date:** [October 31, 2026, 6:44pm UTC](https://community.fly.io/t/security-guidance-verifying-fly-proxy-socket-peers-and-forwarded-headers/28891/6 "2026-10-31T18:44:33Z")

</div>

Closed on October 31, 2026, 6:44pm UTC

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