HAProxy community

Haproxy random and rare 503 and 504 error

this is my Haproxy cfg,

sometimes i get randomly and rarely “503 service unavailable no server is available to handle this request” and rarely also “504 Gateway Time-out The server didn’t respond in time.”

in haproxy Logs:

  1. stats stats/ 0/-1/-1/-1/0 503 212 - - SC-- 2/2/0/0/0 0/0 “GET /favicon.ico HTTP/1.1”

  2. front_app~ back_app/srv_app 0/0/0/-1/60002 504 194 - - sH-- 4/3/0/0/0 0/0 “GET / HTTP/1.1”

once i reload the page it works …

any help please ?

As per the documentation:

sH The “timeout server” stroke before the server could return its response headers. This is the most common anomaly, indicating too long transactions, probably caused by server or database saturation. The immediate workaround consists in increasing the “timeout server” setting, but it is important to keep in mind that the user experience will suffer from these long response times. The only long term solution is to fix the application.

Thank you for helping… But I tried both increasing to 50s 100s even 200s and still getting same error messages … Also i decreased the values to 10s 8s 6s…at first it worked fine and the apps opened faster then again the same error messages… By th way i set the same config above for other applications and it worked like a charm :confused: