Hi I’m new to HAPROXY I was able to configure it for my webapp but sometimes I got a 503 error, I checked my config seems to be fine don’t know if maybe I’m doing something wrong here
Here is my config:
global
log 127.0.0.1 local2
chroot /var/lib/haproxy
pidfile /var/run/haproxy.pid
user haproxy
group haproxy
daemon
# turn on stats unix socket
stats socket /var/lib/haproxy/stats
ssl-default-bind-ciphers PROFILE=SYSTEM
ssl-default-server-ciphers PROFILE=SYSTEM
ssl-dh-param-file /etc/haproxy/dhparams.pem
#---------------------------------------------------------------------
common defaults that all the ‘listen’ and ‘backend’ sections will
use if not designated in their block
#---------------------------------------------------------------------
defaults
mode http
log global
option httplog
option dontlognull
option http-server-close
option forwardfor except 127.0.0.0/8
option redispatch
retries 3
timeout http-request 10s
timeout queue 1m
timeout connect 10s
timeout client 1000s
timeout server 1000s
timeout http-keep-alive 10s
timeout check 10s
maxconn 30000
#---------------------------------------------------------------------
haproxy monitor
#---------------------------------------------------------------------
#---------------------------------------------------------------------
listen monitor
bind *:64080
mode http
monitor-uri /health
option httplog
#---------------------------------------------------------------------
haproxy proxy stats
#---------------------------------------------------------------------
#---------------------------------------------------------------------
enable statistics
stats enable
stats uri /stats
stats auth admin:mysecurepass2023
stats refresh 15s
stats show-legends
stats show-node
#---------------------------------------------------------------------
Frontend VIP myapp1.com
#---------------------------------------------------------------------
#---------------------------------------------------------------------
frontend myapp1.com
mode http
bind 10.10.213.111:80
bind 10.10.213.111:443 ssl crt /etc/haproxy/certs/star.myapp1.com.pem
http-request redirect scheme https unless { ssl_fc }
default_backend myapp1.com
#---------------------------------------------------------------------
Backend Web Servers myapp1.com
#---------------------------------------------------------------------
#---------------------------------------------------------------------
backend myapp1.com
balance leastconn
server mywebsvr01 10.10.33.31:443 check cookie myapp1.com maxconn 10000 ssl verify none check-sni myapp1.com sni str(myapp1.com) ca-file /etc/haproxy/certs/star.myapp1.com.pem
server mywebsvr02 10.10.33.41:443 check cookie myapp1.com maxconn 10000 ssl verify none check-sni myapp1.com sni str(myapp1.com) ca-file /etc/haproxy/certs/star.myapp1.com.pem
#---------------------------------------------------------------------
Frontend VIP myapp2.com
#---------------------------------------------------------------------
#---------------------------------------------------------------------
frontend myapp2.com
mode http
bind 10.10.213.112:80
bind 10.10.213.112:443 ssl crt /etc/haproxy/certs/star.myapp2.com.pem
http-request redirect scheme https unless { ssl_fc }
default_backend myapp2.com.com
#---------------------------------------------------------------------
Backend Servers myapp2.com
#---------------------------------------------------------------------
#---------------------------------------------------------------------
backend myapp2.com
balance leastconn
server mywebsvr01 10.10.33.32:443 check cookie myapp2.com.com maxconn 10000 ssl verify none check-sni myapp2.com sni str(myapp2.com) ca-file /etc/haproxy/certs/star.myapp2.com.pem
server mywebsvr02 10.10.33.42:443 check cookie myapp2.com.com maxconn 10000 ssl verify none check-sni myapp2.com sni str(myapp2.com) ca-file /etc/haproxy/certs/star.myapp2.com.pem