Cloudfront not forwarding requests to API Gateway (403 Forbidden)

Viewed 31

I have a custom Lambda function that I set up with API Gateway. When invoking the API gateway resource path with Postman the Lambda gets invoked and does what it should. I enabled CORS on the API Gateway and didn't forget to deploy.

On Cloudfront I set up API Gateway as origin. Also I set up a cache behavior that forwards the headers as you can see in the following screenshot.

enter image description here

The response when invoking the endpoint in Cloudfront is the following:

enter image description here

I also tried removing the Host header, which leads to the same error Code but "MissingAuthenticationToken" as error reason. Because I found in the internet, that CORS might be a reason for this, I also tried setting the CORS headers in the response of my Lambda function which also didn't help.

I'm out of ideas right now. Does anyone know how to help? I had nothing but trouble with Cloudfront so far.

0 Answers
Related