Q17 — AWS DVA-C02 Ch.1

Question 17 of 100 | ← Chapter 1

An application vendor needs to use the client's IP address in its processing logic. The application has been migrated to AWS and is placed behind an Application Load Balancer (ALB). However, all client IP addresses now appear identical. The application must retain its ability to scale horizontally. Given this scenario, what is the most cost-effective solution?

Correct Answer: C. Modify the application code to inspect the X-Forwarded-For header. Ensure the code handles cases where an IP address list is passed in the header.

Explanation

In AWS environments, when an application is deployed behind an Application Load Balancer (ALB), the client’s real IP address is not directly exposed to backend services. Instead, the ALB adds an HTTP header named `X-Forwarded-For`, which contains the original client’s IP address. To enable the application to access the client’s real IP address while preserving horizontal scalability, the best practice is to modify the application code to read and parse the `X-Forwarded-For` header. This ensures correct IP retrieval regardless of backend scaling. Therefore, option C is the correct solution.