Question

In what seems to be a very weird choice, Cloudfront sets the Host header to the origin server host that you specify when forwarding a request.

http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/RequestAndResponseBehaviorCustomOrigin.html

Why is this? More importantly, when using wildcard subdomains, how do I know which subdomain the request is from, when they all forward to the same origin?

Was it helpful?

Solution

Good news- cloudfront supports host header forwarding now. It's listed very deep in the documentation:

Host [header]: CloudFront sets the value to the domain name of the origin that is associated with the requested object.

Presumably, all you need to do is ensure header forwarding is enabled in the Default Cache Behavior Settings:

header forwarding configuration in cloudfront

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top