title: Angular2 OPTIONS method sent when asking for http.GET
body: <p>I'm trying to add <a href="https://en.wikipedia.org/wiki/Basic_access_authentication#Client_side" rel="noreferrer">basic authentification</a> to my angular2 app.</p>
  
  <pre><code>public login() {
      // Set basic auth headers
      this.defaultHeaders.set('Authorization', 'Basic ' + btoa(this.username + ':' + this.password));
  
      console.log('username', this.username)
      console.log('password', this.password)
      console.log(this.defaultHeaders)
  
      // rest is copy paste from monbanquetapiservice
      const path = this.basePath + '/api/v1/development/order';        
  
      let req = this.http.get(path, { headers: this.defaultHeaders });
      req.subscribe(
          _ =&gt; { },
          err =&gt; this.onError(err)
      );
  }
  </code></pre>
  
  <p>What I expect to see is a GET request with the <code>Authorization</code>header I put. </p>
  
  <p>But what I see is first a <strong>OPTIONS</strong> with this headers:</p>
  
  <pre><code>OPTIONS /api/v1/development/order HTTP/1.1
  Host: localhost:8080
  Connection: keep-alive
  Access-Control-Request-Method: GET
  Origin: http://localhost:3000
  User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36
  Access-Control-Request-Headers: authorization, content-type
  Accept: */*
  Referer: http://localhost:3000/
  Accept-Encoding: gzip, deflate, sdch
  Accept-Language: en-GB,en-US;q=0.8,en;q=0.6,fr;q=0.4
  </code></pre>
  
  <p>Since my server doesn't allow <strong>OPTIONS</strong> on this url, I get an error.</p>
  
  <p>I know that some methods like PUT or POST send first an OPTIONS method to preflight the request, but GET doesn't. </p>
  
  <p>Why does angular2's http send a OPTIONS first?</p>
  
  <p>Thanks.</p>