Headers to be removed:
Server
X-Powered-By
X-AspNet-Version
I have found a way to remove the Server header but I still cant find how to remove the other headers programmatically (i.e. as a servicestack plugin or something).
Thanks
Yannis
Headers to be removed:
Server
X-Powered-By
X-AspNet-Version
I have found a way to remove the Server header but I still cant find how to remove the other headers programmatically (i.e. as a servicestack plugin or something).
Thanks
Yannis
To remove X-AspNet-Version
you need to add enableVersionHeader="false"
attribute to httpRuntime
element in system.web
section of web.config
<system.web>
<httpRuntime targetFramework="4.5" enableVersionHeader="false" />
</system.web>
To remove X-Powered-By
add this to web.config:
<system.webServer>
<httpProtocol>
<customHeaders>
<clear />
<remove name="X-Powered-By" />
</customHeaders>
</httpProtocol>
</system.webServer>
since i hate xml configs:
using ServiceStack;
namespace My.Project.API.Plugins
{
public class RemoveServicestackAddsFeature : IPlugin
{
public void Register(IAppHost appHost)
{
appHost.Config.GlobalResponseHeaders.Remove("X-Powered-By");
}
}
}