Convert src ip to dns name in haproxy 1.8


#1

Is there any way to have haproxy convert the src ip into its dns name?
Example:
client ip is 192.168.1.5 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=192.168.1.5, but I would like it to append &cpuname=cpu.domain.com


#2

Hi,

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).