HAProxy community

Convert src ip to dns name in haproxy 1.8


Is there any way to have haproxy convert the src ip into its dns name?
client ip is and dns its name is cpu.domain.com

using the following code in haproxy.cfg
http-request set-uri %[url]&cpuname=%[src]
This appends &cpuname=, but I would like it to append &cpuname=cpu.domain.com



This is not yet doable, but there is a WIP feature that may meet your requirement.

It’s an HTTP action that can make DNS resolution at runtime.

That said, current implementation only supports A and AAAA records and what you need is a PTR one (which needs to be implemented into HAProxy).

If you know in advance the list of IP/hostname, I would use a map for now. If the IP/hostname configuration changes quite often, then you have to wait for the code above to be commited (in 1.9 maybe).