# On a backend server restart, it always gives 503 error

**URL:** https://discourse.haproxy.org/t/on-a-backend-server-restart-it-always-gives-503-error/5726
**Category:** Help!
**Created:** [September 17, 2020, 12:23pm UTC](https://discourse.haproxy.org/t/on-a-backend-server-restart-it-always-gives-503-error/5726 "2020-09-17T12:23:09Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![tridevk](https://avatars.discourse-cdn.com/v4/letter/t/db5fbb/32.png) [@tridevk](https://discourse.haproxy.org/u/tridevk)
#### Post date: [September 17, 2020, 12:23pm UTC](https://discourse.haproxy.org/t/on-a-backend-server-restart-it-always-gives-503-error/5726/1 "2020-09-17T12:23:09Z")

</div>

Hi,  
I have set up where there are multiple back end servers. On restart of any backend server, on accessing the page , it gives 503 error as below:-

===========

# 503 Service Unavailable

# No server is available to handle this request.

On haproxy restart it works once again. This does not seem to be an appropriate behavior. I would like to know how HAProxy keeps track of the backend servers. on restart of backend server, how it will know if the service has become up.

Can anybody kindly help?

regards  
tridev

---

<div class="post-metadata">

### Author: ![jerome](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.haproxy.org/jerome/32/984_2.png) [@jerome](https://discourse.haproxy.org/u/jerome)
#### Post date: [September 17, 2020, 1:26pm UTC](https://discourse.haproxy.org/t/on-a-backend-server-restart-it-always-gives-503-error/5726/2 "2020-09-17T13:26:00Z")

</div>

Hi,

It’s hard to help without some configuration shared. Can you please provide the configuration for an affected backend?

---

<div class="post-metadata">

### Author: ![tridevk](https://avatars.discourse-cdn.com/v4/letter/t/db5fbb/32.png) [@tridevk](https://discourse.haproxy.org/u/tridevk)
#### Post date: [September 17, 2020, 1:41pm UTC](https://discourse.haproxy.org/t/on-a-backend-server-restart-it-always-gives-503-error/5726/3 "2020-09-17T13:41:29Z")

</div>

Hello Jerome,  
Thanks for responding.  
Following is my haproxy.cfg. I have tried to restart backend “otntomcat” and “ntsm\_serv” and it gives the same problem with both.  
Request your help.  
thanks  
Tridev

global  
log stdout format raw local0 debug  
defaults  
mode http  
log global  
option http-server-close  
option httplog  
option dontlognull  
option redispatch  
option forwardfor  
retries 3  
backlog 4096  
timeout client 20s  
timeout client-fin 20s  
timeout connect 5s  
timeout server 20s  
timeout tunnel 15m  
timeout http-keep-alive 30s  
timeout http-request 10s  
timeout queue 5s  
timeout tarpit 60s  
default-server inter 3s rise 2 fall 3

frontend web\_gateway  
bind \*:7777 ssl crt /usr/local/etc/haproxy/cert.crt  
log 127.0.0.1 local0 debug  
redirect scheme https if !{ ssl\_fc }  
http-request add-header X-Forwarded-Proto https  
http-request set-query %[query,regsub(:7777,g)]  
http-request set-uri %[url,regsub(otntomcat,"$ipv4addr",g)]  
acl otntomcat\_path path\_beg -i /oms1350  
acl dojoroot\_path path\_beg -i /dojoroot  
acl p1 path\_beg -i /jointroot  
acl p2 path\_beg -i /jquery  
acl p3 path\_beg -i /lodash  
acl p4 path\_beg -i /openlayersroot  
acl p5 path\_beg -i /search  
acl p6 path\_beg -i /svgutilsroot  
acl p7 path\_beg -i /d3root  
acl p8 path\_beg -i /backbone  
acl p9 path\_beg -i /Cpb  
use\_backend otntomcat if otntomcat\_path || dojoroot\_path || p1 || p2 || p3 || p4 || p5 || p6 || p7 || p8 || p9  
acl cas\_path path\_beg -i /cas  
acl session\_path path\_beg -i /session-manager  
use\_backend nspos\_serv if cas\_path || session\_path  
acl fault\_path path\_beg -i /FaultManagement  
use\_backend nspos\_serv1 if fault\_path  
acl int\_path path\_beg -i /internal  
use\_backend nspos\_serv if int\_path  
acl ntsm\_path path\_beg -i /ntsm  
use\_backend ntsm\_serv if ntsm\_path  
acl systemmonitor\_path path\_beg -i /systemmonitor  
use\_backend systemmonitor\_serv if systemmonitor\_path  
default\_backend nspos\_serv

backend otntomcat  
mode http  
balance roundrobin  
log stdout local0 debug  
server serv01 otntomcat:8443 check ssl verify none  
http-response replace-header Location (._)(\botntomcat\b)(._)$ \1"ipv4addr"\3 http-response replace-header Location (.\*)(\b443\b)(.\*) \17777\3  
http-response replace-header Location (._)(\b8544\b)(._) \17777\3 http-response replace-header Location (.\*)(\b8545\b)(.\*) \17777\3  
http-response replace-header Location (._)(\b8443\b)(._)$ \17777\3  
http-response replace-header Location (._)(\b/oms1350/pages/otn\b)(._) \1:7777/oms1350/pages/otn\3  
http-request add-header X-Forwarded-Proto https if { ssl\_fc }

backend nspos\_serv  
mode http  
balance roundrobin  
log stdout local0 debug  
acl p1 path\_beg -i /session-manager  
acl p2 path\_beg -i /cas  
acl p3 path\_beg -i /oms1350  
acl c1 hdr(Location) urlp(service)  
server srv01 nspos:443 check ssl verify none  
http-response replace-header Location (._)(\botntomcat\b)(._)$ \1"ipv4addr"\3 http-response replace-header Location (.\*)(\b\/cas\/login\b)(.\*) \1:7777\/cas\/login\3 http-response replace-header Location (.\*)(\b\/oms1350\/login\b)(.\*) \1:7777\/oms1350\/login\3 http-response replace-header Location (.\*)(\b\/session-manager\/login\b)(.\*) \1:7777\/session-manager\/login\3 http-response replace-header Location (.\*)(\b:7777:7777\/session-manager\/login\b)(.\*) \1:7777\/session-manager\/login\3 http-response replace-header Location (.\*)(\b8443\b)(.\*) \17777\3  
http-response replace-header Location (._)(\b/cas/logout\b)(._) \1:7777/cas/logout\3  
http-request add-header X-Forwarded-Proto https if { ssl\_fc }

backend nspos\_serv1  
mode http  
balance roundrobin  
log 127.0.0.1 local0 debug  
server srv01 nspos:8544 check ssl verify none  
http-response replace-header Location (._)(\b8544\b)(._)$ \17777\3  
http-request add-header X-Forwarded-Proto https if { ssl\_fc }

backend ntsm\_serv  
mode http  
balance roundrobin  
log stdout local0 debug  
server srv01 ntsm:8546 check ssl verify none  
http-response replace-header Location (._)(\b8546\b)(._)$ \17777\3  
http-request add-header X-Forwarded-Proto https if { ssl\_fc }

backend systemmonitor\_serv  
mode http  
balance roundrobin  
log stdout local0 debug  
server srv01 mnc-admin:8547 check ssl verify none  
http-response replace-header Location (._)(\b8547\b)(._) \17777\3 http-response replace-header Location (.\*)(\b8548\b)(.\*) \17777\3  
http-request add-header X-Forwarded-Proto https if { ssl\_fc }

listen stats  
bind \*:1974  
stats enable

---

<div class="post-metadata">

### Author: ![jerome](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.haproxy.org/jerome/32/984_2.png) [@jerome](https://discourse.haproxy.org/u/jerome)
#### Post date: [September 17, 2020, 1:48pm UTC](https://discourse.haproxy.org/t/on-a-backend-server-restart-it-always-gives-503-error/5726/4 "2020-09-17T13:48:32Z")

</div>

if you use names for server addresses on your server lines, and the IP address associated to the name changes, haproxy can’t know until you restart it if you don’t use a [resolvers](https://cbonte.github.io/haproxy-dconv/2.2/configuration.html#5.3.2) section as detailed [here](https://cbonte.github.io/haproxy-dconv/2.2/configuration.html#5.3)

I’m guessing that’s what happens here since you fix it with an haproxy restart.

---

<div class="post-metadata">

### Author: ![tridevk](https://avatars.discourse-cdn.com/v4/letter/t/db5fbb/32.png) [@tridevk](https://discourse.haproxy.org/u/tridevk)
#### Post date: [September 18, 2020, 8:57am UTC](https://discourse.haproxy.org/t/on-a-backend-server-restart-it-always-gives-503-error/5726/5 "2020-09-18T08:57:07Z")

</div>

Thank You very much.  
after adding a resolver section it started working. appreciate your support.

regards

Tridev
