I currently have a POST function that works through the Gateway and Lambda APIs, which are accessed from the Angular client with CORS. Although I do not know what your configuration is, I can share all of my relevant settings in the hope that you might find something that you missed. Enabling CORS at the moment is pretty painful (and hopefully something Amazon is working on a fix), requiring a lot of small steps in many areas with pretty bad documents.
I have 2 methods (OPTIONS and POST) for my resource, and I will share the corresponding settings for each:
POST:
Method request: nothing special. In the case of my endpoint, I have an option in the "Request paths" section for one of the route parameters. I do not use a query string, so the Query String URL is empty. HTTP request headers are also empty.
Integration Request:
Integration type: Lambda Matching patterns: I have one (application / json) with a template for transferring the corresponding values ββfrom the request body and route parameters to my lambda function.
Method Answer:
Expand the status code field 200. Add a title for "Access-Control-Allow-Origin" and click the checkmark button to save it. You may need to do this for any other status codes you may have.
Integration answer:
Expand the response field 200. In the "Header Headers" section, change the display value to "*". Single quotes are required. You may need to do this for any other integration answers you may have.
OPTIONS:
Method Request:
Nothing special like the POST method.
Integration Request:
I decided to set up the integration process. According to Amazon, this does not matter, so I just decided that he was taunting, because all we really need to do is answer 200 with the appropriate headings. No matching patterns.
Method Answer:
Expand the status code field 200. Add the following 3 response headers and save them using the checkbox: Access-Control-Allow-Headers , Access-Control-Allow-Methods , Access-Control -Allow-Origin . There are no other status codes.
Integration answer:
Expand the response field 200. The regex is empty (set by default), and this method only has a 200 response. Expand the header mappings and set the headers to the following values:
Access-Control-Allow-Headers: 'Content-Type,X-Amz-Date,Authorization,X-Requested-With' Access-Control-Allow-Methods: 'GET,POST,OPTIONS' Access-Control-Allow-Origin: '*'
No matching patterns.
Then expand your API. Hopefully now it resolves CORS requests. I ran into the same problem as you, and I am sure that the problem in X-Requested-With is not listed in Access-Control-Allow-Headers.