I have haproxy 1.5.8, it proxies some requests (based on the path) to a third-party we have no control over.
Since the IP of backend server is resolved once at startup, it breaks if the IP change.
If there a workaround for that ? In nginx it's possible to declare an internal variable and have it cached for X seconds. I didn't found a similar solution for HAProxy.
With the recent release of HAProxy 1.6 there is a solution to your problem. You can now define resolvers and associate these to your backend. IP resolution will then be done at runtime.
StackOverflow discussing this
Link to the corresponding documentation
Unfortunately, it seems like this is still a work in progress.
Have you considered using a separate nginx proxy? So that you forward requests for that backend to an nginx instance, which then does DNS resolution and forwards the request? Not ideak, but may work in a lower traffic environment.