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 Risposta
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
con risposta 2 anni fa

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.

Linee guida per rispondere alle domande