使用 AWS re:Post 即表示您同意 AWS re:Post 使用條款

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
已提問 1 年前檢視次數 1132 次
2 個答案
1
已接受的答案

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
專家
已回答 1 年前
profile pictureAWS
專家
已審閱 1 年前
  • 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
已回答 1 年前
  • Thank you for these information. I'm now using cURL to troubleshoot other issues in my WordPress.

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南