@troyanov thanks for quick response, before implementing ssl I was able to loadbalance using simple configuration, now for some reason it does not work anymore, now I use
global
maxconn 100
tune.ssl.default-dh-param 2048
#log 127.0.0.1:514 local0
defaults
log global
mode http
retries 2
timeout client 1m
timeout connect 4s
timeout server 1m
timeout check 5s
#option forwardfor if-none
option http-server-close
#option httplog
frontend maas_region_controller-v4
bind :5240
bind :5443 ssl crt /etc/ssl/private/maas_tls.pem
default_backend maas_region_controllers
use_backend maas_region_controllers
backend maas_region_controllers
option redispatch 2
balance roundrobin
timeout server 90s
#option forwardfor if-none
#http-request add-header X-Forwarded-Port 5443
#http-request add-header X-Forwarded-Proto https
hash-type consistent
server maas-ha-1 10.10.10.101:5240
server maas-ha-2 10.10.10.102:5240
which proviously was
global
maxconn 100
defaults
log global
mode tcp
retries 2
timeout client 30m
timeout connect 4s
timeout server 30m
timeout check 5s
frontend maas_region_controller-v4
bind 10.10.10.10:5240
mode tcp
use_backend maas_region_controllers
backend maas_region_controllers
balance roundrobin
server maas-ha-1 10.10.10.101:5240
server maas-ha-2 10.10.10.102:5240
The requests look like(10.10.10.104 is my haproxy) :
url -i -L -X GET http://10.10.10.104:5240/MAAS
HTTP/1.1 301 Moved Permanently
server: nginx/1.18.0 (Ubuntu)
date: Wed, 01 Mar 2023 13:06:16 GMT
content-type: text/html
content-length: 178
location: https://10.10.10.104:5443/MAAS
curl: (28) Failed to connect to 10.10.10.104 port 5443 after 21079 ms: Timed out
What is wrong in this config?
The funny fact is that requests sent directly to one of the hosts(both http://10.10.10.10101:5240/MAAS which gets redirected to the latter and https://10.10.10.101:5443/MAAS) work just fine.
Sorry for trouble and thank you very much for the patience
Mateusz