Clients receive HTTP 502, 503, or 504 errors when attempting to connect to web servers running on EC2 instances configured to use Classic Load Balancing.
The resolutions for HTTP 5XX vary. See the following pages for more information:
HTTP 502 (Bad Gateway)
HTTP 502 errors can occur if either the web server or associated back-end application servers running on EC2 instances return a message that cannot be parsed by Classic Load Balancer (CLB).
For help resolving this error, see I get HTTP 502 errors when I make requests through a load balancer. How do I troubleshoot these errors?
HTTP 503 (Service Unavailable)
HTTP 503 errors can occur for several reasons, including:
- Insufficient web server or back-end application server instance resources available to service client requests.
- Web server instances or back-end application server instances fail the Classic Load Balancer (CLB) heath check.
- One or more processes running on web server instances or back-end application server instances are down or inaccessible via the expected TCP/IP port number (for example TCP port 80 for HTTP).
- A security group or access control list (ACL) misconfiguration is preventing access to back-end application server instances.
- You have not registered back-end instances in every Availability Zone that your Classic Load Balancer is configured to respond in. See Configure Cross-Zone Load Balancing for more information.
- Connection draining is not enabled for the Classic Load Balancer that your web server instances are registered with.
For help resolving this error, see How do I troubleshoot HTTP 503 errors returned when using a Classic Load Balancer?
HTTP 504 (Gateway Timeout)
HTTP 504 errors can occur for the following reasons:
- Web server instances or back-end application server instances are busy and cannot respond to requests within the configured Elastic Load Balancing (ELB) idle timeout limit.
- Web server instances or back-end application server instances terminate connections before the load balancer does, resulting in premature connection terminations.
- Web server instances or back-end application server instances have crashed or restarted server processes when requests are in-flight, which results in the server breaking all connections.
- Apache web server instances have the AcceptFilter http/https option enabled which instructs Apache to implement TCP_DEFER_ACCEPT on the connections.
- Apache web server instances have the event MPM enabled and have not optimally configured the prefork and worker MPMs given the default ELB idle timeout limit of 60 seconds. For more information, see What are the optimal settings for using Apache as a back-end server for ELB?
For help resolving this error, see How do I troubleshoot HTTP 504 errors returned when using a Classic Load Balancer?