I've looked at the other related questions on SO but this seems different. In fact, my question is very similar to this one, except I don't have the 400 status issue.
The set up:
I've used the "Enable CORS" option - I've tried applying this option on both the resource, and the POST request (and deploying the API afterwards).
In API GW, I can see Access-Control-Allow-Origin listed in 200 Response Headers under POST method - Method Response area.
Result: Calling the endpoint from client code in Chrome, OPTIONS passes but POST fails due to missing Access-Control-Allow-Origin header.
In curl: OPTIONS call
curl -X OPTIONS -H "Access-Control-Request-Method: POST" \
-H "Access-Control-Request-Headers: Content-Type" \
-H "Origin: http://example.com" --verbose <endpoint>
the response is:
< HTTP/1.1 200 OK
< Content-Type: application/json
...
< Access-Control-Allow-Headers: Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token
< Access-Control-Allow-Methods: POST,OPTIONS
< Access-Control-Allow-Origin: *
...
but with POST:
curl -X POST -d '{}' -H "Content-Type: application/json" \
-H "Origin: http://example.com" --verbose <endpoint>
it returns:
< HTTP/1.1 200 OK
< Content-Type: application/json
...
and the response json body - but no Access-anything header.
What else can I check?