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?

有帮助吗?

解决方案

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

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top