title: Mobile only CORS Error: Origin is not allowed by Access-Control-Allow-Origin In Node.js
body: <p>I've set up a Node.js (TypeScript hosted on Google Cloud Platform [GCP]) app for CORS but I'm still getting errors (Origin is not allowed by Access-Control-Allow-Origin) on mobile--desktop works fine.</p>
  
  <p>I've searched but there are so many questions about getting this set up in general, I can't find why it specifically isn't working for mobile.</p>
  
  <pre><code>    this.app.use(cors()); 
      this.app.options('*', cors());
  </code></pre>
  
  <p>...</p>
  
  <pre><code>    router.use(function(req, res, next) {
            res.header('Content-Type', 'application/json');
            res.setHeader('Access-Control-Allow-Origin', '*');
            res.setHeader('Access-Control-Allow-Methods', 'DELETE,GET,OPTIONS,PATCH,POST');
            res.setHeader('Access-Control-Allow-Headers', 'Origin, Accept, Authorization, Content-Type, X-Requested-With, Access-Control-Allow-Headers, Access-Control-Request-Method, Access-Control-Request-Headers');
            next();
          });
  </code></pre>
  
  <p>BTW The errors don't appear in the console until a few minutes after the page has loaded. (I've removed the URLs which are valid.)</p>
  
  <p>"XMLHttpRequest cannot load  due to access control checks."</p>
  
  <p>"Failed to load resource: Origin  is not allowed by Access-Control-Allow-Origin."</p>