Bypass CORS policy on S3-hosted site connected to RDS database

0

I have a public domain in S3 connected to an RDS database via MySQL, a lambda function that runs scripts on the MySQL database, and an API gateway that sends queries to the lambda function. Whenever I try to make an API call from my site, I get the error below.

Access to XMLHttpRequest at (lambda url) from origin (my site) has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

How can I get around this?

1 Answer
1

You can activate CORS on the API-Gateway. https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-cors.html
This will add the required OPTIONS Method for the preflight Request to your API.

AWS
Marco
answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions