CORS

Understand cross-account resource sharing and its implementation with AWS API Gateway.

Cross-account resource sharing

One of the most frustrating recurring errors when using the API Gateway is:

Blocked by CORS policy. No Access-Control-Allow-Origin header is present on the requested resource.

Before we try to fix this, let’s try to understand CORS and why it’s required.

Cross-Origin Resource Sharing (CORS) protection is a browser feature. Most modern browsers implement it. It’s a way of safeguarding the content by ensuring that a website doesn’t make unauthorized calls to an API hosted by someone else. A website, take https://example.com, ...