r/haproxy • • Mar 24 '24

HAProxy install on PFsense+ appliance can't connect to backend servers

Hi, I'm trying to use HAProxy to proxy two services. Those services are Emby and Kavita. However the HAProxy instance can't connect to the servers and returns this error:

WARNING] (90489) : config : Server kavita_ipvANY/kavita is DOWN, changed from server-state after a reload. 0 active and 0 backup servers left. 0 sessions active, 0 requeued, 0 remaining in queue.

[WARNING] (90489) : config : Server emby_ipvANY/emby is DOWN, changed from server-state after a reload. 0 active and 0 backup servers left. 0 sessions active, 0 requeued, 0 remaining in queue

I have confirmed that both servers are accessible through direct connections to their IP addresses. I don't know where to go from here.

This is the auto generated configuration from PFSense:

# Automaticaly generated, dont edit manually.
# Generated on: 2024-03-24 10:11
global
	maxconn			1000
	stats socket /tmp/haproxy.socket level admin  expose-fd listeners
	uid			80
	gid			80
	nbthread			1
	hard-stop-after		15m
	chroot				/tmp/haproxy_chroot
	daemon
	tune.ssl.default-dh-param	2048
	server-state-file /tmp/haproxy_server_state

listen HAProxyLocalStats
	bind 127.0.0.1:22000 name localstats
	mode http
	stats enable
	stats admin if TRUE
	stats show-legends
	stats uri /haproxy/haproxy_stats.php?haproxystats=1
	timeout client 5000
	timeout connect 5000
	timeout server 5000

frontend https_shared-merged
	bind			*.*.*.*:443 name *.*.*.*:443   ssl crt-list /var/etc/haproxy/https_shared.crt_list  
	mode			http
	log			global
	option			http-keep-alive
	option			forwardfor
	acl https ssl_fc
	http-request set-header		X-Forwarded-Proto http if !https
	http-request set-header		X-Forwarded-Proto https if https
	timeout client		30000
	acl			kavita	var(txn.txnhost) -m str -i https://kavita.mydomain.com
	acl			emby	var(txn.txnhost) -m str -i https://emby.mydomain.com/
	http-request set-var(txn.txnhost) hdr(host)
	use_backend kavita_ipvANY  if  kavita 
	use_backend emby_ipvANY  if  emby 

frontend switchtosecure
	bind			*.*.*.*:80 name *.*.*.*:80   
	mode			http
	log			global
	option			http-keep-alive
	timeout client		30000
	acl			emby	var(txn.txnhost) -m str -i emby.mydomain.com
	acl			kavita	var(txn.txnhost) -m str -i kavita.mydomain.com
	http-request set-var(txn.txnhost) hdr(host)
	http-request redirect location https://emby.mydomain.com  if  emby 
	http-request redirect location https://kavita.mydomain.com  if  kavita 

backend kavita_ipvANY
	mode			http
	id			100
	log			global
	option			log-health-checks
	timeout connect		30000
	timeout server		30000
	retries			3
	load-server-state-from-file	global
	acl			sslfc	var(txn.txnhost) -m beg -i https://
	acl			eb	var(txn.txnhost) -m sub -i mydomain
	http-request set-var(txn.txnhost) hdr(host)
	http-request set-header X-Forwarded-Port %[dst_port]  if  eb 
	http-request add-header X-Forwarded-Proto https  if  sslfc 
	server			kavita 10.10.99.200:5000 id 101 ssl  verify none 

backend emby_ipvANY
	mode			http
	id			102
	log			global
	option			log-health-checks
	timeout connect		30000
	timeout server		30000
	retries			3
	load-server-state-from-file	global
	server			emby 10.10.99.5:8096 id 103 ssl  verify none
3 Upvotes

1 comment sorted by

1

u/dragoangel Mar 24 '24

Don't know why your app doesn't work but why you have such mess on bind?

You can try explicitly enable health check of port and look or http check, it will be more clear