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 réponse
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
répondu il y a 2 ans

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions