An organization hosts a web application behind an Application Load Balancer (ALB). The instances are registered to a target group listening on port 80. The ALB health check is configured to check the path `/healthz`. During a recent deployment, the application configuration was updated, and now the load balancer reports all target instances as unhealthy, resulting in HTTP 503 Service Unavailable errors. A review of the web server logs on the instances shows that requests to `/healthz` return a status code of HTTP 302 (Found) and redirect to `/home`. Which action is the most direct way to resolve this issue and return the instances to a healthy state?
- AAssociate a Route 53 active-passive failover routing policy with the ALB to route health check traffic to a backup domain.
- BUpdate the subnet's outbound network ACL rules to allow traffic on ephemeral ports 1024-65535 back to the ALB.
- Configure the target group's health check settings to include 302 in the Matcher (Success codes) range.Answer
- DChange the target group health check port configuration to port 443 to bypass the port 80 redirect.
Answer
Configure the target group's health check settings to include 302 in the Matcher (Success codes) range.
The correct action is to modify the target group's health check configuration to accept the HTTP 302 status code in the Success codes (Matcher) range. By default, Application Load Balancers expect an HTTP 200 response for health checks. Since the application redirects the health check path `/healthz` to `/home` with an HTTP 302 status code, the ALB marks the instances as unhealthy. Adding 302 to the matchers tells the ALB that a 302 redirect represents a healthy state.
Step-by-Step Solution
Key Concept
Application Load Balancer health check status code matching