Elastic Beanstalk Environment Health Sever: Process default has been unhealthy for 51 minutes (Target.ResponseCodeMismatch) or(Target.TimedOut) with ELB Target: 502 Bad Gateway


One of my environment start to get into Environment Health Sever state with Target.ResponseCodeMismatch while on the ELB target, the instance was listed as HTTP 502: Bad gateway I've verified below all looks correctly setup for me, but still not able to get the Environment Health back to normal

  1. Load Balancer setting for listener and processors all on HTTP, PORT 80, for processor the Health check path is /health (this is the same as my other environment), the respond code was left as default 200
  2. Load Balancer is in a EB default created security group and EC2 Instance also has EB default created security group where is allowing traffic from and to ELB over 80
  3. Subnet is in a subnet where ACL is allowing traffic on all port I also restarted and launched new instance couple of times, the error is not going away
1 Answer

Hello there,

The error "Target.ResponseCodeMismatch" is thrown when an application does not return the expect code to the ELB. For example, if you have configured health checks with expected status of 200 OK and your application returns 301 the error will be thrown.

Kindly confirm how your application is responding to the ELB health check requests by checking the application logic and the Apache/Nginx access logs.

To best troubleshoot this issue, we require information that is non-public information. Please open a support case with AWS Support using the following link

answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions