Posted On: Jul 22, 2020
Amazon CloudFront now provides enhanced granular control to configure headers, query strings, and cookies that can be used to compute the cache key or forwarded to your origin from your CloudFront distributions. Further, you can configure the cache key and origin request settings independently as account-level policies that can be easily applied across multiple distributions.
Previously, when you configured your CloudFront distribution behavior to forward request metadata such as headers, query strings, and cookies, CloudFront would cache separate versions of these objects based on all the unique combinations of these metadata values. With this new functionality, you do not need to choose between forwarding data to the origin and optimizing cache efficiency by only varying the cache key when absolutely needed. For example, you can configure CloudFront to always forward 'Auth' or 'User-Agent' headers to your origin, but not vary content based on these values. Or you can forward everything, but select a specific header or query string parameter to use for varying the cached content, such as using the ‘Accept-Language’ header to serve localized content variants by client languages supported.
In addition, these options are now set using policies. A policy allows for the same specific combination of settings to be easily applied across many different distribution behaviors, saving setup time and complexity and allowing you to manage consistency across configurations. CloudFront also provides several system policies that are preconfigured. These include default policies for maximum caching and retention (max TTLs, compression, etc.), policies appropriate for proxying dynamic transactions (disable caching), and even some policies for common use cases and integrations with other AWS services, like personalized video streaming with AWS Elemental Media Package, and S3 CORS header support (forwarding of certain expected headers). You can create your own policies for different content and application profiles, and then apply them to any distributions and behaviors that have similar characteristics.
This feature is available for immediate use and is supported in the CloudFront Console, APIs, SDK, and CLI. For more information, refer to the CloudFront Developer Guide and API documentation. There is no additional fee for using this feature. Regular CloudFront charges apply.