No 'Access-Control-Allow-Origin' header. Origin is therefore not allowed access. The response had HTTP status code 400
<p>Currently I built API server at HTTPS together with mobile and website. The front-ends mobile(ionic web/mobile) with port 8100 is working with the API HTTPS. But when it comes to angular web with port 9999, the API HTTPS doesn't work so well, but running API server at localhost:8888 work like a charm.</p>

<p><strong>ExpressJS</strong></p>

<pre><code>var cors = require('cors');
var http = require('http');
var app = express();
var server = http.createServer(app);
var port = process.env.PORT || 3000; // Always running at port 8888
app.use(cors());
</code></pre>

<p><strong>Request Header</strong></p>

<pre><code>Accept:application/json, text/plain, */*
Accept-Encoding:gzip, deflate, sdch, br
Accept-Language:en-US,en;q=0.8
Authorization: (Some long string here)
Cache-Control:max-age=0
Connection:keep-alive
Host: api.web.com
Origin: http://localhost:9999
</code></pre>

<p><strong>Problem</strong></p>

<blockquote>
  <p>I don't have issue using POST API to server before user authorization. After I stored access token on Authorization header and direct to dashboard, every methods of API calls (GET,PUT,POST) returns 400 BAD REQUEST.</p>
  
  <p>No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '<a href="http://localhost:9999" rel="nofollow noreferrer">http://localhost:9999</a>' is therefore not allowed access. The response had HTTP status code 400.</p>
</blockquote>