API Gateway, AWS Lambda: CORS still blocking me

Viewed 15

Lambda newbie here. I access a simple Lambda function I created via Getaway API. Created a POST method. (not using proxy)

On creation, I configured it to allow CORS. (checked the CORS checkbox) In the OPTIONS header I see that It already put:

Access-Control-Allow-Headers = 'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token' Access-Control-Allow-Methods = 'OPTIONS,POST'

In addition, I understand I need to configure the POST method itself. In 'Method Response' I added a Access-Control-Allow-Origin in the headers, in 'Integration Response' I gave it '*'.

I run a simple JS script on the outside, just to test it. For example:


var xhr = new XMLHttpRequest();
xhr.open('POST','https://fo418p5huk.execute-api.us-east-1.amazonaws.com/dev/compare-yourself');
xhr.onreadystatechange = function(event) {
  console.log(event.target.response);
}

xhr.send();

I still get CORS errors. What am I missing??

Thank You! (Also any ideas on how to further debug this would be appreciated)

0 Answers
Related