Question

Difficulty: MediumElastic Load Balancing Health Checks and Troubleshooting

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?

  1. A
    Associate a Route 53 active-passive failover routing policy with the ALB to route health check traffic to a backup domain.
  2. B
    Update the subnet's outbound network ACL rules to allow traffic on ephemeral ports 1024-65535 back to the ALB.
  3. Configure the target group's health check settings to include 302 in the Matcher (Success codes) range.Answer
  4. D
    Change 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

1
Analyze the web server logs and ALB health check failure symptoms.
The server logs show HTTP 302 status codes being returned for `/healthz` health check requests.
By default, the ALB target group expects an HTTP 200 OK status code to mark target instances as healthy. Any other status code, including redirects like 302, is treated as a health check failure.
2
Adjust target group health check matcher settings to accommodate the application's redirect behavior.
The ALB now successfully marks the targets as healthy after receiving the HTTP 302 code.
By specifying '200,302' or '302' in the Success codes (Matcher) of the target group configuration, the ALB will accept the redirect response as normal functioning rather than an error.

Key Concept

Application Load Balancer health check status code matching
Rate this question