2

I'm not sure if this was a change in IIS 7 or if someone before me actively removed X-Server from the HTTP response headers but I need to be able to tell which server in the farm served the current page. I don't see X-Server in the custom variables section of IIS but I'm not sure if it was a custom variable in the first place or if it's in the defaults and it's been disabled via web.config. How do I get my headers back?

David Perry
  • 1,324
  • 5
  • 14
  • 31

1 Answers1

-1

You can use custom headers (http://www.iis.net/ConfigReference/system.webServer/httpProtocol/customHeaders) to add any header you like.

Stephen S.
  • 1,616
  • 16
  • 14
  • I found this easily enough, but it's not documented what value, when added via this tutorial, populates the response header with the name of the server which fulfilled the request. – David Perry Jun 25 '12 at 22:11
  • 1
    The way we're using it is to hardcode the servername (or something you can hash to the servername) into the custom header on each server. To avoid having to actually manually set it on each server, we use a powershell script which takes in a set of servers, and then goes out and sets the header appropriately on each (using the servername it's connecting to as a variable). Once that is done, the header will be a part of the page, then you can use tools like firebug/fiddler to see all headers. Are you trying to actually put the value on the result page itself? – Stephen S. Jun 26 '12 at 15:07
  • Mea culpa, I had a moment of braindeath and forgot completely that custom headers are per-server in a farm environment. Thanks! – David Perry Jun 28 '12 at 17:42