title: Express server not allowing CORS even though I'm using Access-Control-Allow-Origin *
body: <p>The browser error shows: </p>
  
  <pre><code>Access to XMLHttpRequest at &lt;https://dev-api.mydomain.net/auth/login&gt; from origin 'https://dev.mydomain.net' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
  </code></pre>
  
  <p>I also tried using my actual specific domain '<a href="https://dev.mydomain.net" rel="nofollow noreferrer">https://dev.mydomain.net</a>'as the Access-Control-Allow-Origin value, and it didn't work, as well as trying the key 'origin' as well.</p>
  
  <p>How can I get the server to accept requests from my domain?</p>
  
  <pre><code>import express from 'express'
  import cors from 'cors'
  import router from '../../routes'
  
  const restServer = express()
  
  restServer.use(cors({
    'Access-Control-Allow-Origin': '*'
  }))
  
  restServer.use('', router)
  
  export default restServer
  </code></pre>