My haproxy.cfg file has two backend servers using hostnames:
server ops-ca-revealv2e-prod-1 ops-ca-revealv2e-prod-1:443 cookie ops-ca-revealv2e-prod-1 ssl weight 1 maxconn 512 check
server ops-ca-revealv2e-prod-2 ops-ca-revealv2e-prod-2:443 cookie ops-ca-revealv2e-prod-2 ssl weight 1 maxconn 512 check
These hostnames are part of Amazon OpsWorks and are injected into /etc/hosts automatically whenever an instance comes up or down. If I attempt to restart HAProxy when one of the instances is down, I receive the error:
[ALERT] 362/225440 (27202) : parsing [/opt/haproxy-ssl/haproxy.cfg:42] : 'server ops-ca-revealv2e-prod-2' : invalid address: 'ops-ca-revealv2e-prod-2' in 'ops-ca-revealv2e-prod-2:443'
[ALERT] 362/225440 (27202) : Error(s) found in configuration file : /opt/haproxy-ssl/haproxy.cfg
[ALERT] 362/225440 (27202) : Fatal errors found in configuration.
Is there a way to tell HAProxy to check if a hostname is valid? If it is valid, use it, if not, ignore it.