About load balancer

I’m using a Haproxy load balancer instead of aws.
How can I rewrite the front end and backend of the Haproxy config file with node name and its IP?