title: NodeJS - CORS middleware `origin` undefined
body: <p>I have an app using the <code>cors</code> npm package as middleware.  I have it set up like this: </p>
  
  <pre><code>  if(process.env.NODE_ENV === 'production') {
      var whitelist = ['http://mywebsite.com', 'https://mywebsite.com']
      var corsOptions = {
        origin: (origin, callback) =&gt; {
            var originIsWhitelisted = whitelist.indexOf(origin) !== -1;
            console.log('ORIGIN: ', origin);  // =&gt; undefined
            callback(originIsWhitelisted ? null : 'Bad Request', originIsWhitelisted)
        },
        credentials:true
      }
      app.use(cors(corsOptions));
    }
  </code></pre>
  
  <p>The <code>origin</code> parameter in my corsOptions is <code>undefined</code>.  Why is this and how can I fix it?</p>