When using AWS::ApiGateway::DomainName
, it creates hidden CloudFront
distribution to actually fetch custom domain name. The problem is that when passing original request down to something like ELB
, original headers are lost, including Host header. I need Host header in my application that is deployed in ECS
.
Possible solution is to create Lambda@Edge
function that adds X-Forwarded-Host
header and maps it to the value of Host header. The problem is that I cannot figure out how to create Lambda Function Association on hidden Cloudfront
distribution that ApiGateway
creates.
Is there actually a possibility to have Host header preserved in ApiGateway
with Custom Domain name setup, as for now?