- Newest
- Most votes
- Most comments
Since CloudFront responds from content stored in the cache when all URLs and specified parameters match, if all request parameters coming from users are included in the cache key, the cache hit rate will decrease.
I think the reason why the User-Agent HTTP header is removed is that if the user-agent header is forwarded, the cache will be managed for each user-agent string, which will make the cache inefficient.
CloudFront can use headers such as "CloudFront-Is-Android-Viewer" to identify devices.
https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/adding-cloudfront-headers.html#cloudfront-headers-device-type
The reason we are removing session cookies for static content is that we are not changing what is displayed based on session cookies.
As described in the following document, configuring CloudFront to forward cookies to an origin that does not vary its response based on cookies may result in more requests being forwarded to that origin for the same content, leading to poor performance.
https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/Cookies.html
Amazon S3 and some HTTP servers don’t process cookies. Don’t configure CloudFront to forward cookies to an origin that doesn’t process cookies or doesn’t vary its response based on cookies. That can cause CloudFront to forward more requests to the origin for the same object, which slows performance and increases the load on the origin. If, considering the previous example, your origin doesn’t process the country cookie or always returns the same version of locations.html to CloudFront regardless of the value of the country cookie, don’t configure CloudFront to forward that cookie.
The difference between this and Answer A is that if you remove the Host HTTP header, access from CloudFront to the origin will be on the origin domain.
Since the certificate issued by ACM is also used by the Application Load Balancer in this case, I expect that the lack of a host header would result in a certificate error.
From the above, I thought that answer "D" was the correct answer.
Relevant content
- asked 10 months ago
- asked 2 years ago
- Accepted Answerasked 3 months ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 2 months ago
- AWS OFFICIALUpdated 2 months ago
- AWS OFFICIALUpdated a day ago
thanks for details. can you please explain more what you mean by - "if all request parameters coming from users are included in the cache key, the cache hit rate will decrease."?
CloudFront returns cache information when all request parameters match. For example, if the User-Agent information matches, cache is returned. However, since User-Agent information is most likely to vary from device to device, the cache hit rate is reduced because the origin content is accessed without returning a cache. Although we used User-Agent as an example, other request parameters must also match, so including all parameters in the cache key will cause the cache hit ratio to drop.