A SysOps administrator is troubleshooting an Application Load Balancer (ALB) that has marked all registered Amazon EC2 instances as unhealthy. The instances host a web application that listens on port 80 and is configured to automatically redirect all incoming HTTP traffic to HTTPS (port 443) using an application-level rewrite rule. The ALB is configured for SSL termination on port 443. The target group is configured to perform health checks on port 80 using the HTTP protocol at path `/healthz`, expecting a default response code of 200. Which of the following is the most appropriate action to resolve this issue and mark the targets as healthy?
- AModify the target group health check configuration to use HTTPS on port 443.
- BModify the subnet network access control list (NACL) rules to permit outbound traffic from the EC2 instances to the ALB on ephemeral ports.
- Update the target group health check configuration to accept HTTP 301 or 302 status codes as successful responses.Cevap
- DConfigure an active-passive failover routing policy in Amazon Route 53 to redirect health check requests directly to the instance Elastic IPs.
Cevap
Update the target group health check configuration to accept HTTP 301 or 302 status codes as successful responses.
The correct answer is to update the target group health check configuration to accept HTTP 301 or 302 status codes. Because the web application redirects all incoming HTTP port 80 traffic to HTTPS, any HTTP health check request to the path `/healthz` on port 80 will return a redirect status code (301 or 302) instead of 200. Since the default ALB target group health check only considers 200 as successful, the instances are marked unhealthy. Adding 301 and 302 to the target group's expected health check response codes resolves this discrepancy.
Adım Adım Çözüm
Anahtar Kavram
Handling application-level HTTP redirects in Application Load Balancer target group health checks