I'm balancing 3 fronts with HAProxy, but I want to use always the same backend/server with a specific subdomain (admin.mysite.com).
HAProxy is not terminating SSL (I was told this is not good, is better to do that with nginx), so I'm using req_ssl_sni to detect the subdomain because I cannot use acl rules.
But for some reason to some users HAProxy is connecting to the incorrect front when requesting the subdomain, I cannot understand why, this is my config:
global
debug
maxconn 16000
daemon
ssl-default-bind-options force-tlsv12
tune.ssl.default-dh-param 2048
stats socket /var/run/haproxy/info.sock mode 600 level admin
stats timeout 2m
defaults
log global
retries 0
timeout connect 5s
timeout server 50s
timeout client 50s
default-server init-addr libc,none
frontend frontend-http
bind *:80
maxconn 10000
mode http
option forwardfor
use_backend admin-nossl if { hdr_dom(host) -i admin.mysite.com }
use_backend users-nossl if { hdr_dom(host) -i www.mysite.com }
use_backend users-nossl if { hdr_dom(host) -i mysite.com }
default_backend redirect-https
frontend frontend-https-public
bind *:443
maxconn 10000
mode tcp
option tcplog
tcp-request inspect-delay 5s
tcp-request content accept if { req.ssl_hello_type 1 }
use_backend admin if { req_ssl_sni -i admin.mysite.com }
use_backend users if { req_ssl_sni -i www.mysite.com }
use_backend users if { req_ssl_sni -i mysite.com }
backend redirect-https
mode http
redirect scheme https code 301
backend admin-nossl
mode http
server frontend01 [//FRONT_1_IP//]:80 check resolve-prefer ipv4
backend admin
mode tcp
server frontend01 [//FRONT_1_IP//]:443 check resolve-prefer ipv4 send-proxy
backend users-nossl
mode http
balance roundrobin
server frontend01 [//FRONT_1_IP//]:80 check resolve-prefer ipv4
backend users
mode tcp
balance roundrobin
stick-table type binary len 32 size 30k expire 30m
stick on src
server frontend01 [//FRONT_1_IP//]:443 check resolve-prefer ipv4 send-proxy
server frontend02 [//FRONT_2_IP//]:443 check resolve-prefer ipv4 send-proxy
server frontend03 [//FRONT_3_IP//]:443 check resolve-prefer ipv4 send-proxy
Is this a bug in HAProxy or there is something wrong with my config?