Share via


IIS7 – Prevent the server sending its private IP address for a request made by HTTP/1.0 clients with no host header

Do you remember this problem earlier with IIS sending the server’s private address for a request made for a non host-header site in its headers? You were setting UseHostName or SetHostName property in the metabase to stop the server sending the private IP address. This KB article had the hotfix details, and you need to follow the more information section to be able to stop the server sending.

So, what now in IIS7? No metabase right? There is no equivalent to UseHostName, but system.webServer/serverRuntime/alternateHostName  is the equivalent to the SetHostName. Below is the appcmd syntax to set this:

appcmd.exe set config  -section:system.webServer/serverRuntime /alternateHostName:"YourServerName"  /commit:apphost

I did use the IIS7 Configuration Editor’s “Generate Script” option to generate the above, isn’t that really handy?