CORS AND API GATEWAY LAMBDA PROXY INTEGRATION

Enabling CORS

To enable CORS when creating a Lambda Proxy Integration API, you must add the following code to the LAMBDA function:

headers: {
“Access-Control-Allow-Origin” : “*” // Required for CORS support to work
}

So an example payload might be:

var response = {
statusCode: 200,
headers: {
“Access-Control-Allow-Origin” : “*” // Required for CORS support to work
},
body: JSON.stringify({
payload: “My payload”
})
};

This took me a lot searching to find! This certainly helped:┬áservless.com/…