CORS "No 'Access-Control-Allow-Origin' header is present on the requested resource."
<p>I have an error with CORS:</p>

<blockquote>
  <p>"XMLHttpRequest cannot load <a href="http://graphql-swapi.parseapp.com/" rel="nofollow noreferrer">http://graphql-swapi.parseapp.com/</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:3000" rel="nofollow noreferrer">http://localhost:3000</a>' is therefore not allowed access. The response had HTTP status code 405." </p>
</blockquote>

<p>Error when I call a service method.</p>

<p><strong>Code Snippet:</strong></p>

<pre><code>let headers = new Headers();
headers.append('Access-Control-Allow-Origin', '*');
headers.append('Content-Type', 'application/json'); 
headers.append('Accept', 'application/json');
headers.append('Access-Control-Allow-Methods', 'POST');
headers.append('Access-Control-Allow-Headers', 'Content-Type');

//console.log(headers);

return this._http.post(apiUrl, { query: query, vars: '{}' }, { headers: headers })
  .map(res =&gt; res.json().data.planets);
</code></pre>

<p>When I disable CORS in the browser, I get: </p>

<blockquote>
  <p>XMLHttpRequest cannot load xxx. Response for preflight has invalid HTTP status code 405 error. </p>
</blockquote>

<p>A query and code is for sure correct.</p>