Here is my first attempt at this: http://pastebin.com/xXfZJf3f
The diff is over http://git.1wt.eu/git/haproxy-1.4.git/ref eb9632f7c6ae675bdee4c82eb0d298ba7f37fc52 To enable DNS checks on a server, the host name defined configuration should be suffixed with "@ar", and checks must be enabled for the server entry. For example: server server1 hostname.com@ar:5432 check Limitations so far: - only somewhat tested. I'm yet to test the actual switch over, plus the code that sends DNS queries through the queue has never been tested (my requests always sink directly into socket buffer). There are probably DNS responses that will throw the code off - only the first nameserver entry is ever picked from resolv.conf Sorry for dragging in uthash, I didn't find any hash-table implementation in ha-proxy, or thought of a better way to index the server entries for this. Any feedback is greatly appreciated.