A developer is analyzing HTTP access logs on EC2 instances that are behind a public Application Load Balancer (ALB). The server logs show only the ALB's IP address rather than the client's public IP. What must the developer change so the HTTP server log contains the originating client's public IP address?
Choose an answer
Tap an option to check your answer.
Correct answer: Configure the HTTP server to log the X-Forwarded-For request header and ensure the ALB forwards that header..
Why this is the answer
When an Application Load Balancer (ALB) processes a request, it acts as a reverse proxy. This means the ALB terminates the client connection and establishes a new connection to the backend EC2 instance. Consequently, the EC2 instance's access logs will show the ALB's IP address as the source of the request, not the original client's IP. To preserve the original client's IP, ALBs (and other proxies) insert the X-Forwarded-For HTTP header. The correct solution is to configure the HTTP server software on the EC2 instances to parse and log the value of the X-Forwarded-For header. The ALB automatically forwards this header; no additional configuration is needed on the ALB itself for this specific issue. Adding the Host header to logging configuration is incorrect because the Host header indicates the domain name the client requested, not the client's IP. Installing the CloudWatch Logs agent or AWS X-Ray daemon is incorrect because these tools are for collecting and monitoring logs or tracing requests, respectively; they do not modify the content of the HTTP server's access logs to include the client's IP.
Pass your exam — without the endless answer hunt
Get every verified question and explanation for this exam in one place, and save hours of prep. 1,000+ certifications · 20+ languages · free to start.
Pass your exam faster → No card needed