Interview Prep/Networking/Load Balancers, Proxies & CDNs

How does the source IP appear behind ALB, NLB and Cloudflare?

IntermediateConceptLoad Balancers, Proxies & CDNs
Answer

Behind an ALB, the backend sees the ALB's IP and gets the client in X-Forwarded-For. NLB preserves the client IP for instance targets (not for IP targets by default, where you can use PROXY protocol v2). Behind Cloudflare, use CF-Connecting-IP or X-Forwarded-For and trust only Cloudflare's published ranges.

Security groups on backends should allow the LB security group, not the internet.

All Networking questions Roadmap: Networking for DevOps

More on Load Balancers, Proxies & CDNs