Website brings a StatusCode: 503 after a couple of minutes

Hi, I have a haproxy reverse proxy because I have only one ip address for multiple servers. So far everything runs fine with the standards I found on the internet. There is only one webserver (zammad with nginx webserver) which is giving some troubles.

I can login and work with the system, but after a couple of minutes or if I make a browser refresh, I get a popup with the following infomration:


StatusCode: 503

<html><body><h1>503 Service Unavailable</h1>
No server is available to handle this request.
</body></html>

If I press OK multiple times, I can keep on working.

Thanks for any ideas.

Christian.

Hello,

Is the backend server going down on Haproxy stats page or in logfile when you get the error ?

The 503 error is commonly used when there is no valable backend. So check your health check config and have a look on the log files. You should be able to find the reason of theses errors.

Hi,

in the stats page all servers are green, so I checked the haproxy.log (sudo grep-E ‘NOSRV.+503’ /var/log/haproxy.log):

Jan 20 16:38:18 HAPROXY01 haproxy[608]: 127.0.0.1:52884 [20/Jan/2022:16:38:18.939] stats stats/ 0/-1/-1/-1/0 503 221 - - SC-- 7/1/0/0/0 0/0 “GET /favicon.ico HTTP/1.1”
Jan 20 16:38:32 HAPROXY01 haproxy[608]: 192.168.20.18:52455 [20/Jan/2022:16:38:27.685] http_in~ support/ 0/5001/-1/-1/5001 503 221 - - sQ-- 7/7/45/0/0 0/53 “GET https://help.domain.com/api/v1/ticket_attachment/1045/4140/7549?view=preview HTTP/2.0”

There should be an error in my configuration, but I can’t find it…

Hi,
I was able with htop and hatop to find out, that the zammad server is a bit slow. I added already more ressources and optimized some timeouts (Optimizing HAProxy for security and performance by tuning timeouts - deltablue - the user-friendly paas for everyone) and now it’s better but not a 100%.
Is there a working solution to tell HAProxy to be more patient but only with this server?
Thanks,
Christian.

You can set timeout to the backend section to only match these servers. I don’t know if it’s possible to set up different timeout per server in backend section.

Hello @cjs1976

Just a read that you can set specific timeout for server with haproxy 2.4 :

You can use a map file :

# host.map
www.example.com 3000
api.example.com 1000
websockets.example.com 60000

And this config :


frontend fe_main
  http-request set-timeout server req.hdr(host),map_int(host.map)

This way you have different timeout per server.