Share via


Remove Location header from http response

Question

Tuesday, March 24, 2015 3:33 AM

Hi All,

I want to remove unwanted headers (specially location header) in  http response in IIS 8.5.

I have implemented solution "enableHeaderVersion=false" which is working fine in IIS 7.5 but not working in IIS 8.5.

Please help me to resolve the issue.

All replies (1)

Tuesday, March 24, 2015 10:54 PM âś…Answered

Hi,

You can try using IIS url rewrite to remove the header. Please refer to the following rules:

 <outboundRules>
        <!-- This rule changes the domain in the HTTP location header for redirection responses -->
        <rule name="Change Location Header">
            <match serverVariable="RESPONSE_LOCATION" pattern="^http://[^/]+/(.*)" />
            <conditions>
                <add input="{RESPONSE_STATUS}" pattern="^301" />
            </conditions>
            <action type="Rewrite" value=""/>
        </rule>
    </outboundRules>

You can change the rule based on your need. And For more information, please refer to the document:

http://blogs.msdn.com/b/benjaminperkins/archive/2012/11/02/change-or-modify-a-response-header-value-using-url-rewrite.aspx

http://www.saotn.org/remove-iis-server-version-http-response-header/