Interview Prep/Networking/Load Balancing, Proxies & nginx in Production

How do you preserve client IP end to end?

IntermediateProductionLoad Balancing, Proxies & nginx in Production
Answer

Behind ALB: read X-Forwarded-For, trusting only the proxy hop. Behind NLB with instance targets the source IP is preserved; with IP targets enable PROXY protocol v2. With multiple proxy layers, configure the trusted proxy list in the app framework (trust proxy in Express, RemoteIpHeader in Tomcat).

Do not put X-Forwarded-For values into security decisions without trusting only known proxy ranges.

All Networking questions Roadmap: Networking for DevOps

More on Load Balancing, Proxies & nginx in Production