title: Response for preflight has invalid HTTP status code: 401 angular
body: <p>Using angular and Spring Boot we're trying to add authentication to our service but for some reason we can't 'open' and fetch data from an url we know works</p>
  
  <p>Angular: </p>
  
  <pre><code>this.getMismatches = function () {
      return $http({
              "async": true,
              "crossDomain": true,
              "url": GLOBALS.mismatchUrl,
              "method": "GET",
              "headers": {
                  "authorization": "Basic YWRtaW46USNROawdNmY3UWhxQDlQA1VoKzU="
          }
      });
  }
  </code></pre>
  
  <p>(currently the login token is hard coded for testing purposes)</p>
  
  <p>Rest service: </p>
  
  <pre><code>@CrossOrigin(origins = "*")
  @RequestMapping("/api/mismatch")
  public List&lt;Mismatch&gt; home() {
      return service.getAll();
  }
  </code></pre>
  
  <p>CrossOrigin = * should take care of the CORS issue but this failed URL call is really weird.</p>
  
  <p>Extra things we've tried:</p>
  
  <pre><code>'Access-Control-Allow-Methods', 'GET, POST, OPTIONS'
  'Access-Control-Allow-Origin', '*'
  'Content-Type', json plaintext jsonp etc
  
  App.js:
      $httpProvider.defaults.headers.common = {};
      $httpProvider.defaults.headers.post = {};
      $httpProvider.defaults.headers.put = {};
      $httpProvider.defaults.headers.patch = {};
  </code></pre>