title: How do I set up a GCP App Engine instance with CORS?
body: <p>I've set up two different GCP App Engine apps. One is an express server (let's call it foo) with the following app.yaml:</p>
  
  <pre><code>runtime: nodejs10
  handlers:
  - url: /tasks
    static_dir: /tasks
    http_headers:
      Access-Control-Allow-Origin: https://bar.appspot.com/
    secure: always
  </code></pre>
  
  <p>From my bar app, I'm trying to do a fetch call:</p>
  
  <pre><code>const response = await fetch('https://foo.appspot.com/tasks');
  </code></pre>
  
  <p>Every time I try this, however, Chrome blocks my request with the 'has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.' error. I've also tried just replacing the URL in the http_header with '*' to no avail. Why is this? What am I missing?</p>
  
  <p>Edit: After some more digging, I'm finding that the headers being returned from foo don't even include the Access-Control-Allow-Origin header at all.</p>
  
  <p>Edit 2: I finally bypassed this issue by just using the npm cors package: <a href="https://www.npmjs.com/package/cors" rel="nofollow noreferrer">https://www.npmjs.com/package/cors</a></p>