3

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?

eisbehr
  • 12,243
  • 7
  • 38
  • 63
astrosmash
  • 31
  • 1
  • 2

1 Answers1

-2

You can whitelist any header to be sent to the origin. Configure the Host header for forwarding in your API Gateway configuration.

Steve Buzonas
  • 5,300
  • 1
  • 33
  • 55