API Gateway CORS error

0

I set enable CORS in my API Gateway and deployed it. However, my webpage keeps generating CORS error when it calls API. I think it works well at first. What is the problem?

4回答
0

My API is Rest API, and Lambda Proxy integration is checked. Also, I followed "Enable CORS on a resource using the API Gateway console"(https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-cors-console.html). So I think I don't need more action as "Configure your REST API integrations to return the required CORS header" in your link. However, It still does not work. if there is any mistake in my reaction, please let me know. Additionally, I deployed as well.

回答済み 2年前
0

It works now. Thank you. As result, I did

  1. enable CORS in API Gateway.
  2. set header in response in Lambda return.
回答済み 2年前
0

Please take a look at the following troubleshooting guide from AWS Premium Support - https://aws.amazon.com/premiumsupport/knowledge-center/api-gateway-cors-errors/

profile pictureAWS
エキスパート
回答済み 2年前
0

Please take a look at this document - https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-cors.html

the following paragraph

Enabling CORS support for Lambda or HTTP proxy integrations For a Lambda proxy integration or HTTP proxy integration, you can still set up the required OPTIONS response headers in API Gateway. However, your backend is responsible for returning the Access-Control-Allow-Origin and Access-Control-Allow-Headers headers, because a proxy integration doesn't return an integration response.

Since you mentioned you are using Proxy integration, is your backend returning these headers.

profile pictureAWS
エキスパート
回答済み 2年前

ログインしていません。 ログイン 回答を投稿する。

優れた回答とは、質問に明確に答え、建設的なフィードバックを提供し、質問者の専門分野におけるスキルの向上を促すものです。

質問に答えるためのガイドライン

関連するコンテンツ