Interview Prep/Networking/Load balancers and reverse proxies

An ALB target group shows all targets `unhealthy` with `Health checks failed with these codes: [404]`.

BeginnerTroubleshootingLoad balancers and reverse proxies
Answer

Likely causes → The health check path doesn't exist on the app (default is /), the app requires a specific Host header, or a framework redirects/serves 404 for unknown hosts (the ALB sends the target IP as Host).

Diagnose →

aws elbv2 describe-target-health --target-group-arn <tg-arn>
aws elbv2 describe-target-groups --target-group-arns <tg-arn> \
  --query 'TargetGroups[0].[HealthCheckPath,HealthCheckPort,Matcher]'
curl -i http://<target-private-ip>:<port>/health   # from a host in the VPC

Fix → Point the health check at a real lightweight endpoint (/healthz) and set the matcher (200 or 200-399). Allow the app to answer health checks for any Host (e.g. Django ALLOWED_HOSTS, Rails config.hosts).

Prevent → Ship a dedicated health endpoint in every service template and test it in CI.

All Networking questions Roadmap: Networking for DevOps

More on Load balancers and reverse proxies