title: No 'Access-Control-Allow-Origin' header is present on the requested resource - ionic 2 application
body: <p>I receive the following error when i try to access my local server with a POST request:</p>
  
  <blockquote>
    <p>XMLHttpRequest cannot load <a href="http://127.0.0.1:8000/api/v1/users/login" rel="noreferrer">http://127.0.0.1:8000/api/v1/users/login</a>. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '<a href="http://localhost:8100" rel="noreferrer">http://localhost:8100</a>' is therefore not allowed access.</p>
  </blockquote>
  
  <p>My server allows CORS because I've tested it by sending the request with postman and it works.</p>
  
  <p>Here is my code in the front-end:</p>
  
  <pre class="lang-js prettyprint-override"><code>private headers = new Headers({
      'Access-Control-Allow-Origin': '*',
      'Access-Control-Allow-Methods': 'GET, POST, OPTIONS, PUT, PATCH, DELETE',
      'Access-Control-Allow-Headers': 'X-Requested-With,content-type',
      'Access-Control-Allow-Credentials': true 
  });
  
  
  postLogin(data) {
      console.log(data);
      return new Promise((resolve) =&gt; {
          this.http.post(this.api + "users/login", data, {headers: this.headers})
              .map(res =&gt; res.json())
              .subscribe(answer =&gt; {
                   this.loggedIn = true;
                   this.token = answer.token;
                   resolve(answer);
              });
      });
   }
  </code></pre>
  
  <p>PS: I did not get this error with a GET request.</p>
  
  <p>I tried to put a proxy and it doesn't change anything :(</p>
  
  <p>This is my <code>ionic.config.json</code>:</p>
  
  <pre class="lang-js prettyprint-override"><code>{
    "name": "hardShop",
    "app_id": "",
    "v2": true,
    "typescript": true,
    "proxies": [
        {
            "path": "/api",
            "proxyUrl": "http://127.0.0.1:8000"
        }
    ]
  }
  </code></pre>