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.
More on Load Balancing, Proxies & nginx in Production
How do you choose between ALB, NLB and an nginx or Envoy fleet?IntermediateHow do you tune ALB idle timeout and backend keep-alive to avoid 502s?IntermediateWhich nginx directives matter most for a production reverse proxy?IntermediateHow do you do rate limiting and abuse protection in nginx?IntermediateHow do you achieve zero-downtime configuration reloads in nginx and HAProxy?IntermediateHow would you design a highly available load-balancing tier on-prem or in a colo?Advanced