title: 404 for web.api cors OPTIONS
body: <p>I've followed the usual steps for enabling cors in web.api, but get a 404 response to an OPTIONS request in Chrome and in Firefox I get <code>Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://api.mydomain.com/api/1/widgets. This can be fixed by moving the resource to the same domain or enabling CORS.</code></p>
  
  <p>In my WebApiConfig.cs I've got:</p>
  
  <pre><code>var enableCorsAttribute = new EnableCorsAttribute("*", "*", "*");
  config.EnableCors(enableCorsAttribute);
  </code></pre>
  
  <p>I've also tried adding <code>EnableCors</code> attributes to the specific controllers or actions and all have the same result.</p>
  
  <p>I've also added the following to my web.config:</p>
  
  <pre><code>&lt;modules runAllManagedModulesForAllRequests="true"&gt;
    &lt;remove name="WebDAVModule" /&gt;
  &lt;/modules&gt;
  &lt;handlers&gt;
      &lt;remove name="WebDAV" /&gt;
  ...
  </code></pre>
  
  <p>Here is my javascript:</p>
  
  <pre><code>$.ajax({
      url: 'https://api.mydomain.com/api/1/widgets',
      type: "GET",
      headers: {
          Accept: "text/html; charset=utf-8",
          Authorization: 'Bearer ???????????????????????????????'
              }
          });
  </code></pre>
  
  <p>But the response is 404 in Chrome and "Cross-Origin request Blocked" in Firefox.</p>
  
  <p>Here are the details of the failing request from my chrome developer toolbar:</p>
  
  <pre><code>Remote Address:??.???.???.???:443
  Request URL:https://api.mydomain.com/api/1/widgets
  Request Method:OPTIONS
  Status Code:404 Not Found
  </code></pre>
  
  <p>Request</p>
  
  <pre><code>OPTIONS /api/1/widgets HTTP/1.1
  Host: api.mydomain.com
  Connection: keep-alive
  Access-Control-Request-Method: GET
  Origin: http://myotherdomain.com
  User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.143 Safari/537.36
  Access-Control-Request-Headers: accept, authorization
  Accept: */*
  Referer: http://myotherdomain.com/
  Accept-Encoding: gzip,deflate,sdch
  Accept-Language: en-GB,en;q=0.8,en-US;q=0.6
  </code></pre>
  
  <p>Response</p>
  
  <pre><code>HTTP/1.1 404 Not Found
  Pragma: no-cache
  Content-Type: text/html; charset=utf-8
  Access-Control-Allow-Origin: http://myotherdomain.com
  Access-Control-Allow-Credentials: true
  X-AspNetMvc-Version: 5.0
  X-UA-Compatible: IE=edge,chrome=1
  X-Frame-Options: SAMEORIGIN
  Cache-conrol: no-store
  Date: Thu, 28 Aug 2014 16:00:28 GMT
  Content-Length: 341
  </code></pre>
  
  <p>What am I missing?</p>