I recently finished configuring HAProxy to balance a service, it has only one node right now, when I check the configuration file I have the correct output:
haproxy -c -f /etc/haproxy/haproxy.cfg
Configuration file is valid
However, I get the next output when I restart haproxy:
[root@localhost]# systemctl restart haproxy
Message from syslogd@localhost at Sep 27 15:36:49 ...
haproxy[53773]: backend CTVL_servers has no server available!
The logs show me the same messages:
[root@localhost rsyslog.d]# tail -f /var/log/haproxy.log
Sep 27 15:14:41 localhost haproxy[52987]: Server CTVL_servers/token1 is DOWN, reason: Layer7 wrong status, code: 400, info: "Bad Request", check duration: 1ms. 0 active and 0 backup servers left. 0 sessions active, 0 requeued, 0 remaining in queue.
Sep 27 15:14:41 localhost haproxy[52987]: backend CTVL_servers has no server available!
Here is my haproxy.cfg:
#---------------------------------------------------------------------
# Global settings
#---------------------------------------------------------------------
global
log /dev/log local0
log /dev/log local1 notice
chroot /var/lib/haproxy
stats socket /run/haproxy/admin.sock mode 660 level admin
stats timeout 30s
user haproxy
group haproxy
daemon
# to have these messages end up in /var/log/haproxy.log you will
# need to:
#
# 1) configure syslog to accept network log events. This is done
# by adding the '-r' option to the SYSLOGD_OPTIONS in
# /etc/sysconfig/syslog
#
# 2) configure local2 events to go to the /var/log/haproxy.log
# file. A line like the following can be added to
# /etc/sysconfig/syslog
#
log 127.0.0.1 local2 debug
pidfile /var/run/haproxy.pid
maxconn 4000
# utilize system-wide crypto-policies
ssl-default-bind-ciphers PROFILE=SYSTEM
ssl-default-server-ciphers PROFILE=SYSTEM
#---------------------------------------------------------------------
# common defaults that all the 'listen' and 'backend' sections will
# use if not designated in their block
#---------------------------------------------------------------------
defaults
log global
mode http
option httplog
timeout connect 5000ms
timeout client 50000ms
timeout server 50000ms
#---------------------------------------------------------------------
# main frontend which proxys to the backends
#---------------------------------------------------------------------
frontend main
mode http
bind 192.168.10.78:80
bind 192.168.10.78:443 ssl crt /etc/haproxy/certs/haproxyTI.pem alpn h2,http1.1 ssl-min-ver TLSv1.2
redirect scheme https code 301 if !{ ssl_fc }
default_backend CTVL_servers
#---------------------------------------------------------------------
# round robin balancing between the various backends
#---------------------------------------------------------------------
backend CTVL_servers
balance roundrobin
option httpchk
http-check connect
http-check send meth HEAD uri /login ver HTTP/1.1 hdr Host 192.168.10.96
#http-check expect status 200
server token1 192.168.10.96:443 ssl alpn h2,http/1.1 verify none check
I have configured the contexts on SELinux and also checked the ports on the firewall. when I perform a curl it works, so maybe I have something misconfigured or the fact that I only have one server as a backend at the moment is wrong.
If anyone can guide me please, thank you so much in advance.