# Haproxy throwing intermittent 503 as it can not establish a backend server connection after 4 retries

**URL:** <https://discourse.haproxy.org/t/haproxy-throwing-intermittent-503-as-it-can-not-establish-a-backend-server-connection-after-4-retries/3809>\
**Category:** Help!\
**Created:** [May 13, 2019, 3:50pm UTC](https://discourse.haproxy.org/t/haproxy-throwing-intermittent-503-as-it-can-not-establish-a-backend-server-connection-after-4-retries/3809 "2019-05-13T15:50:46Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![jareepuzha](https://avatars.discourse-cdn.com/v4/letter/j/dc4da7/32.png) [@jareepuzha](https://discourse.haproxy.org/u/jareepuzha)\
**Post date:** [May 13, 2019, 3:50pm UTC](https://discourse.haproxy.org/t/haproxy-throwing-intermittent-503-as-it-can-not-establish-a-backend-server-connection-after-4-retries/3809/1 "2019-05-13T15:50:46Z")

</div>

Hi, We are using haproxy 1.7 with docker image and it is throwing intermittent 503 errors with error code sC, I could see that this is reaching client time out of 15s and after 4 times to connect (3s time to connect).

we are using http-server-close to release backend connections immediately after serving one request.  
Is this causing increased connection attempts? can I use http-reuse instead?  
Here is my configuration, can you please help me to tune this config.

How can I determine what is the root cause of delay from tcpdump ?

global  
ssl-server-verify none  
tune.ssl.default-dh-param 2048  
tune.maxrewrite 4096  
log 127.0.0.1:514 local0  
stats socket /opt/haproxy.sock

listen stats #Listen on all IP’s on port 9090  
bind \*:9090  
mode http  
balance  
timeout client 5000  
timeout connect 4000  
timeout server 30000  
stats enable  
stats hide-version  
stats refresh 30s  
stats show-node  
stats uri /haproxy?stats

monitor-uri /status

defaults  
log global  
mode http  
option httplog  
option log-health-checks  
option dontlognull  
timeout client 15000  
timeout connect 3000  
timeout server 180000  
retries 4  
option http-server-close

#create new frontend to process 443  
frontend https\_frontend  
bind \*:443 ssl crt /opt/ert.pem force-tlsv12  
mode http

default\_backend backend\_https

frontend http\_frontend  
bind \*:80  
mode http

default\_backend nike\_http

#Define backend for above frontend  
backend bakend\_https  
mode http  
option httpchk GET /healthchek HTTP/1.1\r\nHost:\ blah  
http-check expect ! rstatus ^5  
server server blah:443 check inter 40000 ssl verify none

#Define backend for above frontend  
backend backend\_http  
mode http  
server blah:80
