title: Getting 'has been blocked by CORS policy' while trying to upload file
body: <p>I was trying to set a ui for uploading excel file using angular8. The front and backend (nodejs) applications are running in two different ports. While  clicking upload button i am getting errors.</p>
  
  <p>Have tried adding this code:</p>
  
  <pre><code>app.use(cors());
  app.use(function (req, res, next) {
    res.setHeader('Access-Control-Allow-Origin', '*');
    res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS, PUT, PATCH, DELETE');
    res.setHeader('Access-Control-Allow-Headers', 'X-Requested-With,content-type');
    res.setHeader('Access-Control-Allow-Credentials', true);
  
    next();
  });
  </code></pre>
  
  <p>still same error</p>
  
  <p>typescript:</p>
  
  <pre><code>url_='http://localhost:3000/product/upload-exel'
      public uploader :FileUploader = new FileUploader({
        url:this.url_
      });
  </code></pre>
  
  <p>html:</p>
  
  <pre><code>&lt;input type="file"  id="file"
  ng2FileSelect [uploader]="uploader"
  [(ngModel)]="path"&gt;
  </code></pre>
  
  <p>OPTIONS <a href="http://localhost:3000/product/upload-exel" rel="nofollow noreferrer">http://localhost:3000/product/upload-exel</a> 404 (Not Found)
  Access to XMLHttpRequest at '<a href="http://localhost:3000/product/upload-exel" rel="nofollow noreferrer">http://localhost:3000/product/upload-exel</a>' from origin '<a href="http://localhost:4000" rel="nofollow noreferrer">http://localhost:4000</a>' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute.</p>