HAProxy 504 gateway timeout – Quick Fix!!
Are you frustrated with HAProxy 504 gateway timeout error? We’ll help you fix it.
Usually, this error occurs due to web server errors and is a tricky one to resolve.
At Bobcares, we often receive requests to fix this error as part of our Server Management Services.
Today, let’s have a look at how our Support Engineers fix this error for our customers.
Before getting detailed into the error, let’s discuss HAproxy. Actually, load balancing helps to prevent server overload.
Sometimes, the workload in a server cluster causes overload in a single server. As a result of this, the server may breakdown.
So, load balancing is the process of distributing the workloads across multiple servers so as to reduce the overload.
And, High Availability Proxy or HAProxy is a popular load balancer used to improve the performance of the server environment.
It can run on Linux, Solaris, FreeBSD and so on. It is most suitable for high traffic web sites. Let’s now see how our Support Engineers easily fix the errors related to HAProxy.
How we fix the HAProxy 504 gateway timeout error?
Recently, one of our customers approached us with an HAProxy error. He was getting a 504 timeout error.
The timeout values in the haproxy.cfg are as follows:
Our Support Engineers checked the error in detail and found errors with the webserver.
On checking the logs, we found long-running requests. The sH in the log indicates the session state at disconnection.
Here, s indicates the server-side timeout expired while waiting for the server to send or receive data.
And, H indicates that the proxy is waiting for complete, valid response HEADERS from the server.
The timeout error occurs when the connection has been established and requests were sent. But, the server cannot finish returning all the response headers to the proxy.
We increased the timeout server so that the server gets enough time to respond. This finally, resolved the error.
[Need more assistance to fix this error?- We’re available 24/7.]
In short, HAProxy 504 gateway timeout occurs when the server cannot finish returning all the response headers to the proxy. In today’s write up, we discussed how our Support Engineers easily fix this error for our customers.