Configure HAProxy to include host headers for different backends
I'm not sure if the following will work, and can't test right now, but maybe this is still helpful. (I'll have a look again later with some more time):
Solution 1:
backend nodes
mode http
balance roundrobin
option forwardfor
http-request set-header Host node1.myapp.mycompany.com if { srv_id 1 }
http-request set-header Host node2.myapp.mycompany.com if { srv_id 2 }
server web01 node1.myapp.mycompany.com:80
server web02 node2.myapp.mycompany.com:80
Solution 2:
backend nodes
mode http
balance roundrobin
option forwardfor
http-send-name-header Host
server node1.myapp.mycompany.com node1.myapp.mycompany.com:80
server node1.myapp.mycompany.com node2.myapp.mycompany.com:80