Which load-balancing solution meets these requirements?
Use an Application Load Balancer and the X-Forwarded-For headers.
Use a Network Load Balancer (NLB). Enable proxy protocol support on the NLB and the target application.
Use an Application Load Balancer. Register the targets by the instance ID.
Use a Network Load Balancer and the X-Forwarded-For headers.
Explanations:
An Application Load Balancer (ALB) automatically adds the client’s IP address in theX-Forwarded-Forheader, which can be accessed by the target application.
A Network Load Balancer (NLB) supports the Proxy Protocol, but it does not useX-Forwarded-For. Instead, it forwards the original client IP in the Proxy Protocol header.
Registering targets by instance ID in an ALB does not help access the client IP addresses. It only specifies how targets are registered, not how client IPs are handled.
NLB does not useX-Forwarded-Forheaders. It relies on the Proxy Protocol to pass the original client IP, not the HTTP headers.