Can anyone advise how to hide the IIS 7.5 in HTTP header?
Thanks alot for any advice and any inputs are appreciated.
Basically is to hide it from the headers.
Can anyone advise how to hide the IIS 7.5 in HTTP header?
Thanks alot for any advice and any inputs are appreciated.
Basically is to hide it from the headers.
You can accomplish this by editing the registry.
In HKLM\SYSTEM\CurrentControlSet\Services\HTTP\Parameters
, create a DWORD entry called DisableServerHeader
and set the value to 1
.
Also, you can use the URLRewrite module or install URLScan, more about this in the following article:
http://blogs.msdn.com/b/varunm/archive/2013/04/23/remove-unwanted-http-response-headers.aspx
I had researched this as Registry entry mentioned above does not remove this; however, the URLRewrite method works well. Can't seem to find the change scripted anywhere well. I wrote this compatible with PowerShell v2 and above and tested it on IIS 7.5.
# Add Allowed Server Variable
Add-WebConfiguration /system.webServer/rewrite/allowedServerVariables -atIndex 0 -value @{name="RESPONSE_SERVER"}
# Rule Name
$ruleName = "Remove Server Response Header"
# Add outbound IIS Rewrite Rule
Add-WebConfigurationProperty -pspath "iis:\" -filter "system.webServer/rewrite/outboundrules" -name "." -value @{name=$ruleName; stopProcessing='False'}
#Set Properties of newly created outbound rule
Set-WebConfigurationProperty -pspath "MACHINE/WEBROOT/APPHOST" -filter "system.webServer/rewrite/outboundRules/rule[@name='$ruleName']/match" -name "serverVariable" -value "RESPONSE_SERVER"
Set-WebConfigurationProperty -pspath "MACHINE/WEBROOT/APPHOST" -filter "system.webServer/rewrite/outboundRules/rule[@name='$ruleName']/match" -name "pattern" -value ".*"
Set-WebConfigurationProperty -pspath "MACHINE/WEBROOT/APPHOST" -filter "system.webServer/rewrite/outboundRules/rule[@name='$ruleName']/action" -name "type" -value "Rewrite"