title: No 'Access-Control-Allow-Origin' header on Angular 2 but cURL works fine
body: <p>I am developing an application using Angular 2 and I find the following error when I try to make an API call:</p>
  
  <blockquote>
    <p>XMLHttpRequest cannot load <a href="http://localhost:9090/conf" rel="nofollow noreferrer">http://localhost:9090/conf</a>. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '<a href="http://localhost:5555" rel="nofollow noreferrer">http://localhost:5555</a>' is therefore not allowed access.</p>
  </blockquote>
  
  <p>Here, there are two examples of my calls:</p>
  
  <pre><code>import { Http, Response } from '@angular/http';
  
  // ...
  
  @Injectable()
  export class ConfService {
  
    // ...
  
    getConf(): Observable&lt;string[]&gt; {
      return this.http.get(
                        'http:localhost:9090/conf?id=1',
                        {
                          headers: {
                            'Accept': 'application/json;charset=UTF-8'
                          }
                        }
                      )
                      .map((res: Response) =&gt; res.json())
                      .catch(this.handleError);
    }
  
    setConf(conf: any[]): Observable&lt;string[]&gt; {
      return this.http.get(
                        'http:localhost:9090/conf?id=1',
                        conf,
                        {
                          headers: {
                            'Content-Type': 'application/json;charset=UTF-8'
                          }
                        }
                      )
                      .map((res: Response) =&gt; res.json())
                      .catch(this.handleError);
    }
  
  }
  </code></pre>
  
  <p><strong>However, when I use cURL it works!</strong></p>
  
  <pre><code>$ curl -XPUT 'localhost:9090/configuration?id=1' \
  &gt; -H 'Content-Type: application/json'
  &gt; -d '{"conf":1234}'
  Success!
  $ curl -XGET 'localhost:9090/conf?id=1'
  {"conf":1234}
  </code></pre>
  
  <p>What is happening here?</p>
  
  <p>Thanks</p>