API Gateway CORS

  • Must be enabled when you try to call API Gateway from another domain
  • The OPTIONS preflight must contains the following
    • Access-Control-Allow-Methods
    • Access-Control-Allow-Headers
    • Access-Control-Allow-Origin
      Pasted image 20221015102744.png
      Note: If your API has AWS Lambda Proxy enabled, it doesn't go through the API Gateway so this option won't work
  • To do so, you need to send back an Access-Control-Allow-Origin in the Lambda function itself