Troubleshoot a Application load balancer : HTTP 504 error

Troubleshoot a Application load balancer : HTTP 504 error

March 19, 2021 / Eternal Team

A 504 HTTP Bad Gateway is a known problem for system admins and developer alike. The most widely recognized explanation behind this mistake is that the back-end code didn’t react to an event call.

HTTP 504 error is caused by an idle timeout.

You can see on Cloudwatch metrics.

Step 1: Open the AWS Management Console.

Step 2: Go to EC2.

Step 3: Choose the Load Balancer and select your load balancer.

Step 4: From the Description tab, select edit attributes.

Troubleshoot a Application load balancer : HTTP 504 error

Step 5: Type the value for an idle timeout in the range of 1 to 3600 seconds, and save it.

Troubleshoot a Application load balancer : HTTP 504 error

The second reason for HTTP 504 error is that a back-end instance closes its TCP connection with the load balancer before the idle timeout value has been reached.

The load balancer pre-opens TCP connection with the back-end instance for HTTP and HTTPS listeners based on the number of connections it has with active requests. So for a large number of requests, load balancer opens more pre-opened TCP connections and also the load balancer does not use a pre-opened connection immediately if it is not receiving many requests.

This relies upon how you arranged your backend to permit association reuse. Without keep-alive help, the load balancer needs to open another association for each request it gets.

AWS-Consulting-Partner

Talk to AWS Certified Consultant

    Want to start a project?

    It’s simple.

    Contact us