Question:
I have an API Gateway that is one of many origins behind a CloudFront distribution that I created. I am trying to forward certain headers to origins (Host, Origin, among others). When I do not forward any headers, the requests reach the API Gateway just fine. However, as soon as I enable header forwarding in the CloudFront distribution (either All or Whitelist) the API Gateway is no longer able to handle the requests. I get the following error:
1 2 3 4 5 6 |
ERROR The request could not be satisfied. CloudFront wasn't able to connect to the origin. |
Any advice on fixing this problem?
Answer:
As commented above, you can’t forward the Host header to the API Gateway origin. Without the Host header, API Gateway doesn’t know what API is being invoked.