IIS 7 and Above
Configuration & Scripting
IIS 8 + Win2K Server R2 + URLRewrite
Last post Nov 30, 2017 03:32 AM by asaxena
Nov 29, 2017 01:53 PM|asaxena|LINK
I want to hide the IIS version in my web server response. I am trying to do this via URLRewrite for
My web.config looks like so:
<rule name="RewriteServerSoftware" stopProcessing="true">
<match serverVariable="SERVER_SOFTWARE" pattern="." />
<action type="Rewrite" value="MyServer" replace="true" />
This however does not seem to remove the value of Server:Microsoft-IIS/8.0.
What might I be missing?
My environment is Windows Server 2012 R2 and IIS 8.0, hosting an ASP.NET website
Nov 30, 2017 02:47 AM|Yuk Ding|LINK
You could use this rule:
<rule name="rewrite response server" stopProcessing="true">
<match serverVariable="RESPONSE_SERVER" pattern=".*" />
<action type="Rewrite" value="MyServer" />
It will rewrite Server:Microsoft-IIS/8.0 to Myserver.
Nov 30, 2017 03:32 AM|asaxena|LINK
Thank you. This works perfectly. However, I am not able to see this variable in the list of URLRewrite variables in the "Add Server Variable" dialog. SERVER_SOFTWARE looked to be the closest but overriding it does not seem to work.
I used this little code snippet to print out all the variables of Request. Is there a way to enumerate all Response server variables?
For Each serverVar As String in Request.ServerVariables
Response.Write(serverVar & " " & Request(serverVar) & "<br />")