Using CORS with AWS SAM

Question:

I’ve created a few Lambda functions that get triggered by API-Gateway events.

Now I want to enable CORS for these endpoints, but it doesn’t seem to work. In the last few versions of AWS SAM the CORS functionality was added or updated, but I still can’t get it to work.

This is what I tried:

Answer:

You can also specify these in your lambda handlers (Python example):

Leave a Reply