title: Issue with CORS when sending a get request to external API in - NodeJS / heroku
body: <p>I have an app built in 'Angular/NodeJs' that using heroku server.
  In the app i have a option to search for a movies in 'omdbapi' .Everything works great until i preforming a search, the console giving me the next error: </p>
  
  <p><a href="https://i.stack.imgur.com/vXidU.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vXidU.png" alt="enter image description here"></a></p>
  
  <p>When i turn on my CORS extension in chrome it working great.</p>
  
  <p>Can someone please suggest me what is the problem.</p>
  
  <p>node code </p>
  
  <pre><code>const express      = require('express');
  const bodyParser   = require('body-parser');
  const mongoose     = require('mongoose');
  const app          = express();
  const path         = require('path');
  const compression  = require('compression');
  const port         = process.env.PORT || 8000;
  const cors         = require('cors')
  
  app.use(function(req, res, next) {
      res.header("Access-Control-Allow-Origin", '*');
      res.header("Access-Control-Allow-Credentials", true);
      res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE,OPTIONS');
      res.header("Access-Control-Allow-Headers", 'Origin,X-Requested-With,Content-Type,Accept,content-type,application/json');
      next();
  });
  
  app.use(compression());
  app.use(bodyParser.json());
  app.use(bodyParser.urlencoded({ extended: false }));
  app.use("/images", express.static(path.join(__dirname, "images")));
  app.use("/", express.static(path.join(__dirname, "angular")));
  
  app.use((req, res, next) =&gt; {
      res.sendFile(path.join(__dirname, "angular", "index.html"));
  });
  
  
  app.listen(port, () =&gt; {
      console.log("App is running on port " + port);
  </code></pre>
  
  <p>[Edit]
  Still dot working after changing the header to @jbarros suggestion. </p>
  
  <pre><code>const express      = require('express');
  const bodyParser   = require('body-parser');
  const mongoose     = require('mongoose');
  const app          = express();
  const path         = require('path');
  const compression  = require('compression');
  const port         = process.env.PORT || 8000;
  
  app.use(function(req, res, next) {
      res.header("Access-Control-Allow-Origin", '*');
      res.header("Access-Control-Allow-Credentials", true);
      res.header('Access-Control-Allow-Methods', 'GET,PUT,POST,DELETE,OPTIONS');
      res.header("Access-Control-Allow-Headers", 'Authorization, Origin,X-Requested-With,Content-Type,Accept,content-type,application/json');
      next();
  });
  </code></pre>
  
  <p>Angular get function</p>
  
  <pre><code>  getMoviesByName(movieName: string) {
      const url = 'https://www.omdbapi.com/?s=' + movieName + '&amp;apikey=xxxxxxx&amp;type=movie'
      return this.http.get&lt;{Search: ImportedMovieModal[]}&gt;(url)
    }
  </code></pre>