iishttp-headershttpresponse.net-remotingservertag

In a .Net Remoting service hosted in IIS 7.5, how can remove "Server : IIS/7.5" tag form response header


I have a .Net application which uses spring.net remoting to expose remoting services, over IIS 7.5.for security reasons, I want to remove some information like "Server: IIS/7.5" from HTTP response header. I removed other tags like X-Powered-By easily, but, for the Server tag, I tried all the offered solutions on the internet and none of them worked. I tried setting the DisableServerHeader registry key or installing URLrewrite tools and changing my web.config and adding outboundRule or any other coding solution like adding a custom HTTP module or handling preRequestHandling of http context in my global.asax file. but none of them worked for me. basically ,is it possible to remove this value, Server , from the response header, given that I'm using .net 3.5 and .net remoting over IIS 7.5? I should mention that, this tag's value will become empty if I browse any pages that I've put into the host directory , but for my .Net remoting requests it's not working and the value of the server tag in response http header is still IIS/7.5


Solution

  • Unfortunately, you can not really remove the Server header. But you can rewrite its content and empty it. On IIS 7+ (IIS 7, 8.5, 8.0, 8.5, IIS 10.0), use a rewrite outbound rule to remove the webserver version information from the Server: header response.

    You can use the following URL Rewrite Outbound rule:

    <rewrite>    
      <outboundRules rewriteBeforeCache="true">
        <rule name="Remove Server header">
          <match serverVariable="RESPONSE_Server" pattern=".+" />
          <action type="Rewrite" value="" />
        </rule>
      </outboundRules>
    </rewrite>
    

    enter image description here