title: Remove server header in self hosted WebApi response
body: <p>We are using a self hosted WebApi and we are required to remove the server header (Server: Microsoft-HTTPAPI/2.0) of the responses sent.</p>
  
  <p>Since it is self hosted, a HttpModule is not an option. Implementing a <code>DelegatingHandler</code>, access to headers as well as adding is possible. The <a href="http://www.asp.net/web-api/overview/working-with-http/http-message-handlers" rel="noreferrer">asp.net website</a> nicely details how one can do that.</p>
  
  <p>But the server header seems to be added much later in the pipeline since it is not set in the <code>HttpResponseMessage</code> we return from the <code>DelegatingHandler</code>. However, we are able to add values.</p>
  
  <pre><code>async protected override Task&lt;HttpResponseMessage&gt; SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
  {
      HttpResponseMessage response = await base.SendAsync(request, cancellationToken);
      response.Headers.Server.Add(new ProductInfoHeaderValue("TestProduct", "1.0"));
      response.Headers.Add("Server", "TestServerHeader");
  
      return response;
  }
  </code></pre>
  
  <p>Both <code>Server.Add</code> and <code>.Add</code> work as expected. <code>response.Headers.Remove("Server");</code> however does not work, because the server header is not set, <code>response.Headers.Server</code> is empty.</p>
  
  <p>Is there anything i am missing?</p>