A SysOps administrator has configured an Application Load Balancer (ALB) to terminate SSL/TLS traffic and forward requests to a target group of EC2 instances over HTTP on port 80. To ensure all client connections are secure, the administrator added a rewrite rule to the Apache web server configuration on the EC2 instances to redirect all incoming HTTP traffic to HTTPS.
Following this change, users receive a 'Too many redirects' error in their web browsers, and the ALB target group shows all EC2 instances as unhealthy with an HTTP 301 response.
Which action should the administrator take to resolve these issues?
- Modify the Apache rewrite rule on the EC2 instances to only redirect traffic if the X-Forwarded-Proto header is 'http'.Answer
- BUpdate the target group health check configuration's matcher settings to accept a success code of '301'.
- CConfigure an Amazon Route 53 failover routing policy to route all port 80 traffic to a secondary target group.
- DUpdate the target group's port configuration to forward traffic to the EC2 instances over HTTPS on port 443.
Answer
Modify the Apache rewrite rule on the EC2 instances to only redirect traffic if the X-Forwarded-Proto header is 'http'.
Modifying the rewrite rule to check the X-Forwarded-Proto header is the correct solution because it allows the EC2 instances to distinguish between client requests that were already secured (which should not be redirected) and health check or unsecured requests (which do not need redirection or can be handled separately). This stops the infinite redirect loop and allows HTTP health checks on port 80 to return 200 OK.
Step-by-Step Solution
Key Concept
Application Load Balancer health checks and request routing header forwarding (X-Forwarded-Proto) during SSL termination.
Estimated Time:2m 30s