Basically exactly what the title is. I have haproxy fronting a server, and infront of that a DNS to provide a human readable name. I would like to setup haproxy to include either the responding server name or IP address in the response. Originally, I used the method described here. While that works when going directly to the server, if I go to haproxy by the DNS, the cookie contains the DNS name. Outside of the linked method, I've not found anything close to my use case.
Asked
Active
Viewed 390 times
0
-
Rather than looking at HAProxy, can’t you configure the backend server to add a header that identifies itself? – Bob Sep 22 '20 at 06:22
-
If by the backend server, you mean the service running on it, then yes, I could. However, I was told to focus my efforts on using haproxy to do this universally instead of adding code to each backend service to add an identifying header. Basically, haproxy is required. – SVill Sep 22 '20 at 12:53
1 Answers
0
Use srv_id
and add a header in the backend
definition. Like
http-response set-header X-Served-By 192.168.0.1 if { srv_id 1 }
http-response set-header X-Served-By 192.168.0.2 if { srv_id 2 }
etc.

tater
- 1,445
- 2
- 10
- 12