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년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인