Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to identify which web server in a farm served a request?

We're debugging intermittent issues with a website running on IIS7.

Since we have many nodes behind the load balancer, we can't tell which host responded to a given request. Is there any way at the IIS level to specify which host served a request? For example, could IIS append a header in the response that indicates the IP of the host that sent the response?

Ideally, I would like a solution that does not require any coding.

like image 539
frankadelic Avatar asked Oct 14 '25 09:10

frankadelic


1 Answers

Without writing any code you could just configure a custom HTTP Response Header for each machine in IIS Manager. You'd need to manually enter each IP address or identifier manually using either the GUI or APPCMD.EXE. This can be done globally for all sites:

appcmd.exe set config -section:system.webServer/httpProtocol 
              /+"customHeaders.[name='X-Custom-Name',value='MyCustomValue']"

Or for a single site:

appcmd.exe set config "Default Web Site" -section:system.webServer/httpProtocol 
              /+"customHeaders.[name='X-Custom-Name',value='MyCustomValue']"

I've split these commands over two lines just to fit them in. You should enter them as a single line.

like image 191
Kev Avatar answered Oct 17 '25 13:10

Kev



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!