Thanks for this I couldn’t figure out why my haproxy started breaking!
FYI my use case is that I’m proxying a possibly scaled docker-compose “fooservice”. Docker’s internal dns automatically resolves “fooservice” to each of the containers started when scaling up this service.
By listing 5 servers lines I can get up to 5 different ip addresses. This seemed like the only option a few years ago, maybe there is a better way to do this now?
backend www-backend-foo
balance roundrobin
server www-foo fooservice:80 check resolve-opts allow-dup-ip resolvers docker resolve-prefer ipv4
server www-foo fooservice:80 check resolve-opts allow-dup-ip resolvers docker resolve-prefer ipv4
server www-foo fooservice:80 check resolve-opts allow-dup-ip resolvers docker resolve-prefer ipv4
server www-foo fooservice:80 check resolve-opts allow-dup-ip resolvers docker resolve-prefer ipv4
server www-foo fooservice:80 check resolve-opts allow-dup-ip resolvers docker resolve-prefer ipv4
server www-foo fooservice:80 check resolve-opts allow-dup-ip resolvers docker resolve-prefer ipv4