In 1.8 haproxy takes all records returned by the dns resolver into account where is in 1.7 only the first one in the list. That's the difference I was referring to in my previous comment. Having this in mind your setup might not work as you expect in case when your service has more than one endpoint.
Regarding your specific example, what exactly is not working? Haproxy will perform dns resolution on startup and my guess would be it throws an error since %[hdr(host)] at that point is empty. On Sat, Sep 16, 2017 at 1:11 AM, Ludovic Gasc <[email protected]> wrote: > I have tested with HAProxy 1.7. > > Where you see that it's a feature of 1.8 ? > You mean I could try my piece of configuration on HAProxy 1.8, it should > work ? > > Regards. > > > 2017-09-15 14:47 GMT+02:00 Igor Cicimov <[email protected]>: > >> >> >> On Fri, Sep 15, 2017 at 9:25 PM, Ludovic Gasc <[email protected]> wrote: >> >>> Hi, >>> >>> I imagine that if I have no answer, it's because it isn't possible with >>> HAProxy ? >>> >>> Thanks for your return. >>> >>> >>> 2017-09-10 22:27 GMT+02:00 Ludovic Gasc <[email protected]>: >>> >>>> Hi, >>>> >>>> I'm trying to reproduce this Nginx configuration with HAProxy: >>>> https://memz.co/reverse-proxy-nginx-docker-microservices/ >>>> >>>> Where it's possible to use DNS as dynamic list to proxy to the right >>>> server. >>>> Our use case isn't container-related, but simply to move easily a >>>> customer from a backend server to another one, without to change the >>>> HAproxy configuration. >>>> >>>> The closest feature in HAProxy seems to be option http_proxy, however, >>>> no DNS lookup is performed: >>>> http://cbonte.github.io/haproxy-dconv/configuration-1.7.html >>>> #4.2-option%20http_proxy >>>> >>>> I have tried to use a resolver in haproxy configuration + in backend >>>> section: >>>> server XXXXXX %[hdr(host)]:8888 resolvers dns >>>> check inter 1000 init-addr last,libc,127.0.0.1 >>>> >>>> However, it doesn't work. >>>> >>>> Maybe with a lua script it's possible to implement that, but I would >>>> prefer to have a simple configuration like with Nginx. >>>> >>>> Do I missed something ? >>>> >>>> BTW, thanks for HAProxy, I like a lot this product ;-) >>>> >>>> Regards. >>>> -- >>>> Ludovic Gasc (GMLudo) >>>> >>> >>> >> This should be a feature in 1.8, which version did you try? >> >> >

