title: Angular/Ionic CORS error with Authorization header
body: <p>I am building an Ionic app (angular 4) and i want to consume an API which is build with C# on an IIS 10.  </p>
  
  <p>When at first did a POST request like that: </p>
  
  <pre><code>this.http.post(my_url, my_credentials, { headers = new HttpHeaders({
      'Content-Type': 'application/x-www-form-urlencoded',
    })
  });
  </code></pre>
  
  <p>i got a cors <strong>error 404</strong> message:  </p>
  
  <pre><code>Failed to load https://some_url/api/login: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8100' is therefore not allowed access.
  </code></pre>
  
  <p>After some research i added on <code>web.config</code>  </p>
  
  <pre><code>access-control-allow-origin: *  
  </code></pre>
  
  <p>and that solved the CORS issues.  </p>
  
  <p>After that i retrieve my access token and wanted to use it for others requests<br>
  so i made another post request with <strong>authorization header</strong> :  </p>
  
  <pre><code>this.http.post(my_url, my_body, { headers = new HttpHeaders({
      'Content-Type': 'application/x-www-form-urlencoded',
      'Authorization': 'Bearer ' + token
    })
  });
  </code></pre>
  
  <p>and then i got the same error as previous.  </p>
  
  <p>So, to sum up those requests are on the same app. The first request work great but the second no.</p>
  
  <p>What's the extra configuration has to put on the server tou accept the extra Authorization header?</p>