title: Capture all requests to Web Api 2.0, regardless that are mapped or not
body: <p>I have a Web API 2.0 running at <code>localhost:4512</code> and I want to intercept all requests made to domain <code>localhost:4512</code> regardless if they are handled by a specific route or not. 
  For instance I want to capture requests made to <code>localhost:4512/abc.dfsada</code> or <code>localhost:4512/meh/abc.js</code></p>
  
  <p>I have tried this with a DelegatingHandler but <a href="https://docs.microsoft.com/en-us/aspnet/web-api/overview/advanced/http-message-handlers" rel="noreferrer">unfortunately</a> this only intercepts requests made to handled routes:</p>
  
  <pre><code>public class ProxyHandler : DelegatingHandler
  {
      private async Task&lt;HttpResponseMessage&gt; RedirectRequest(HttpRequestMessage request, CancellationToken cancellationToken)
      {
          var redirectLocation = "http://localhost:54957/";
          var localPath = request.RequestUri.LocalPath;
          var client = new HttpClient();
          var clonedRequest = await request.Clone();
          clonedRequest.RequestUri = new Uri(redirectLocation + localPath);
  
          return await client.SendAsync(clonedRequest, HttpCompletionOption.ResponseHeadersRead, cancellationToken);
      }
  
      protected override Task&lt;HttpResponseMessage&gt; SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
      {
          return RedirectRequest(request, cancellationToken);
      }
  }
  </code></pre>
  
  <p>and in WebConfig.cs:</p>
  
  <pre><code> config.MessageHandlers.Add(new ProxyHandler());
   config.MapHttpAttributeRoutes();
   config.Routes.MapHttpRoute(
        name: "DefaultApi",
        routeTemplate: "api/{controller}/{id}",
        defaults: new {id = RouteParameter.Optional});
  </code></pre>