title: Using CORS Still Give Cross Origin Error
body: <p>I'm trying to access a node route through angular <code>$http</code> using the <a href="https://www.npmjs.com/package/cors" rel="nofollow"><code>cors</code></a> module. I've tried a simple </p>
  
  <pre><code>app.use(cors());
  </code></pre>
  
  <p>but still get the error. And I've tried adding from <a href="https://www.npmjs.com/package/cors#configuring-cors-w-dynamic-origin" rel="nofollow">the cors documentation a whitelist of URLs</a></p>
  
  <pre><code>var corsOptions = {
    origin: function(origin, callback){
      var originIsWhitelisted = whitelist.indexOf(origin) !== -1;
      callback(null, originIsWhitelisted);
    }
  };
  
  app.get('/someroute/:someparam/', cors(corsOptions), function(req, res, next){
    mymodule.getData(req.params.someparam, function(err, data){
        if (err){
          console.log('error with route', err);
        }else{
          res.json({result: data});
        }
    });
  });
  </code></pre>
  
  <p>But I'm still getting the error</p>
  
  <blockquote>
    <p>XMLHttpRequest cannot load localhost:8888/someroute/undefined. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.</p>
  </blockquote>
  
  <p>I thought that using the cors module was meant to avoid this problem. How can I solve?</p>