Target.ResponseCodeMismatch Error on Application Load Balancer of WordPress Deployed in Elastic Beanstalk

0

The health of the environment is "Severe" and when I viewed the cause, this is the error "Process default has been unhealthy for 1 day (Target.ResponseCodeMismatch)". The health check path was already updated to "/wordpress/" in the Target Group of Load Balancing of EC2.

I checked the EC2 system status "System reachability check passed" and instance status "Instance reachability check passed" , the security group of LB allows any traffic. As far as I know the issue lies on this statement "The health checks did not return an expected HTTP code. Applies only to Application Load Balancers..." from this link: https://docs.aws.amazon.com/elasticloadbalancing/latest/APIReference/API_TargetHealth.html

Any idea guys how to fix this? Thank you in advance.

profile picture
Vin
asked 9 months ago397 views
2 Answers
1
Accepted Answer

Hello.
Is the ALB health check successful?
Perhaps changing the "Matcher" range of the ALB health check to 200-399 might change the status.
My guess is that the HTTP status code is returned as 3xx due to redirects, etc. when accessing the "/wordpress/" health check.
https://docs.aws.amazon.com/elasticloadbalancing/latest/application/target-group-health-checks.html

profile picture
EXPERT
answered 9 months ago
profile pictureAWS
EXPERT
reviewed 9 months ago
  • Amazing Riku! Another ingenious solution to the problem - The health is now "Ok". I set the Success codes to "200-399" and waited for 30 minutes and it went okay.

1

The error message "Target.ResponseCodeMismatch" indicates that the health check response from your target (in this case, your WordPress application) did not match the expected HTTP response code(s) configured in your Application Load Balancer's health check settings.

Here are some steps you can take to troubleshoot and resolve this issue:

  • Check the Health Check Configuration: Ensure that the health check path is correct and the expected status code is set properly. For a WordPress application, the health check path is typically set to the root ("/") or to a specific page that you know exists (like "/wp-admin"). The expected status code is usually "200".
  • Check the Application's Response: You can manually check the response code of your application by sending a request to the health check URL from the instance itself or another instance in the same VPC. You can do this using curl or another similar tool. For example: curl -I http://localhost/wordpress/. The response code should match the one expected by the health check.
  • Check the Security Group and Network ACLs: Ensure that your security group and network ACLs allow inbound traffic on the port your application is listening on (usually port 80 for HTTP or 443 for HTTPS).
  • Check the Application Logs: Check the logs of your WordPress application to see if there are any errors that could be causing the health check to fail.
  • Check the Load Balancer Logs: Enable access logs for your Application Load Balancer to get more information about the health check requests and responses.

If none of these steps resolve the issue, it might be a more specific issue with your WordPress configuration or your Elastic Beanstalk environment. In that case, you might need to dig deeper into the application logs.

profile picture
answered 9 months ago
  • Thank you for these information. I'm now using cURL to troubleshoot other issues in my WordPress.

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