简体   繁体   中英

How to fetch HOST NAME forwarded from S3 to cloudfront?

I am setting up a CDN using AWS S3 and cloudfront services. I have added alernative CNames to access the cloudfront for specific s3bucket. I want to add a routing rule where i need the CName used to access the cloudfront.

More Explaination:

As per my understanding. The S3bucket is the container where we can put our content known as objects. Using the second serivce cloudfront is what caches this content of s3bucket object on different edge servers. We can also add alternative CNames apart from the domainURL provided by Amazon for the cloudfront which is pointing to s3bucket. Now the problem is i want to add the routing rule in s3 bucket but i need to use the alternative Cname used. I hope i have explained my problem. If there is something unclear i would be glad to clear it up. Anyone can tell me how can i do that?

Now the problem is i want to add the routing rule in s3 bucket but i need to use the alternative Cname used.

That isn't possible, for two reasons:

  • S3 does not support implementing routing rules against the incoming Host: header. S3 considers all requests for the same bucket to be the same.

  • CloudFront does not forward the original host header to S3 in any form.

To accomplish what you want, you would need multiple CloudFront distributions and multiple buckets -- one set for each unique group of routing rules.

Did you try using a relative path route? instead of stating the full url for example

/alternative-page.html

I hope i understand the question

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM