I am getting infrequent 404 errors even though the backend servers are running. I even tried to set only one backend server, and the result is the same.
backend keycloak_servers
timeout connect 10s
timeout server 120s
mode http
balance roundrobin #cookie SERVER insert indirect nocache #http-request set-header X-Forwarded-Proto https if { ssl_fc }
http-request set-header X-Forwarded-Host %[req.hdr(Host)]
http-check expect status 200
http-check send meth GET uri /Keycloak
server micro1 myip1:8443 ssl verify none check inter 5s fall 3 rise 2
server micro2 myip2:8443 ssl verify none check inter 5s fall 3 rise 2
Haproxy never generates 404 errors. Common errors that haproxy emits are in the 5xx range, when backend servers cannot be reached, etc, but not 404 (unless very specific configurations are applied like a specific error files with a 404 header).
Enable http logging and check what actually happens, so you can confirm whether this 404 comes from micro1 or micro2.
Here some log entries, one 404 out of 4 calls. I also tested the Keycloak call from Postman, and some calls were receiving 404 even though the calls should be identical