Service stops when entry not DNS resolvable

Hi HAProxy community,

I am pretty new in using HAProxy. I am using it as a super simple bind port and forward to DNS name or IP address. Nothing fancy, one example entry:

log /dev/log local0
log /dev/log local1 notice
chroot /var/lib/haproxy
stats timeout 30s
pidfile /var/run/

maxconn 4000
user haproxy
group haproxy
stats socket /var/lib/haproxy/stats

timeout connect 5m
timeout client 60m
timeout server 60m

log global
mode tcp
option tcplog
maxconn 3000
source 10...4

listen x
bind *:445
server hostname:445 hostname:445 check

My question is, I had issues with DNS names that were not solvable anymore - then HAProxy is not willing to start. Despite the fact that there are other entries that are working - can I configure that behaviour? Shouldn’t HAProxy just skip that entry and start anyway?

Thanks for you advice!

There is a difference between “does not start” and “stop”. In this case, haproxy will reject the configuration and rightly so, otherwise you would have a partially or completely dysfunctional instance.

You can disable this behavior by specifying none as the last resolution method, however you should also setup haproxy resolvers so that this situation is actually recoverable.

 default-server init-addr last,libc,none

Also read Server DNS resolution:

I also have this issue. It is due to a container failing to start because a NAS hasn’t booted. I would prefer to be able to access the remaining services I have until that can be resolved.

Is there any issues with doing the configuration you have shown?

Many thanks, that is indeed the solution.
I would expect from a solution which is called “High-Availability”-proxy to have this behavior set by default. imho

Keep safe and Merry Christmas!

No, an option to hide severe malconfigurations that could lead to outages is not something that should be enabled by default in haproxy.

To respond the question of @simplexion please read about Server DNS resolution in the manual:

HAProxy version 2.2.26-3 - Configuration Manual

I disagree since the stop of the whole service leads to more outages than just disabling one entry.
Agree to disagree.

That’s an erroneous assumption. Haproxy never stops the service. This is about rejecting a invalid configuration that references hostnames that don’t resolve AT STARTUP during configuration parsing.

I already told you in my first response: