Removing the server HTTP header in the standalone OWIN application

I have an application for self-hosting OWIN applications, and I want to remove the server header ("Microsoft-HTTPAPI / 2.0") from all the answers. When searching on Google, this seems like a very simple task, for example. this blog post from MSDN shows a solution that seems very simple. I followed the instructions below:

  • Add the DisableServerHeader registry key to HKLM \ SYSTEM \ CurrentControlSet \ Services \ HTTP \ Parameters and set it to DWORD 1
  • Reboot the server to verify that the HTTP service is receiving the changes.

The result was pretty disappointing, nothing has changed, and I still get the server header. What confuses me is that all decisions do the same, and for them it works. Is there anything else that needs to be done to remove the server header from the self-service OWIN application?

Update I tried to add the server header myself, and it really works, but it still adds Microsoft-HTTPAPI / 2.0.

Adding this code as a DelegatingHandler:

HttpResponseMessage response = await base.SendAsync(request, cancellationToken);
response.Headers.Server.Add(new ProductInfoHeaderValue("Foo", "1.0"));

Creates this server header: Server: Foo / 1.0 Microsoft-HTTPAPI / 2.0

+4
source share

All Articles