I have a application self-hosted OWIN application and I want to remove the Server header ("Microsoft-HTTPAPI/2.0") from all responses. When searching this on Google it looks like a very easy task e.g. this blog post from MSDN shows a solution that seems to be very easy. I followed the instructions:
- Add a registry key DisableServerHeader in HKLM\SYSTEM\CurrentControlSet\Services\HTTP\Parameters and set it to DWORD 1
- Restart the server to make sure HTTP service picks up the change
The result was pretty disappointing, nothing changed and I still get the Server header. What confuses me is, that all solutions do exactly the same and for them it seems to work. Is there anything else that needs to be done to remove the Server header from a self-hosted OWIN application?
Update I tried adding a Server header myself and it actually works but it still adds the 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"));
Produces this Server header: Server: Foo/1.0 Microsoft-HTTPAPI/2.0