From 5f3337fb4da26671040720ae9041d09b9f0136c8 Mon Sep 17 00:00:00 2001 From: watany <76135106+watany-dev@users.noreply.github.com> Date: Sat, 27 Jul 2024 07:28:26 +0900 Subject: [PATCH] chore(cloudfront): adding Managed cache policy (#30797) ### Reason for this change This Updated. https://aws.amazon.com/jp/about-aws/whats-new/2024/07/amazon-cloudfront-managed-cache-policies-web-applications/ ### Description of changes Adding Managed Cache Policies. - [UseOriginCacheControlHeaders](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-cache-policies.html#managed-cache-policy-origin-cache-headers) - [UseOriginCacheControlHeaders-QueryStrings](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-managed-cache-policies.html#managed-cache-policy-origin-cache-headers-query-strings) ### Description of how you validated changes no ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* --- .../aws-cdk-lib/aws-cloudfront/lib/cache-policy.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/packages/aws-cdk-lib/aws-cloudfront/lib/cache-policy.ts b/packages/aws-cdk-lib/aws-cloudfront/lib/cache-policy.ts index d60c486ae6952..ab123d9949f54 100644 --- a/packages/aws-cdk-lib/aws-cloudfront/lib/cache-policy.ts +++ b/packages/aws-cdk-lib/aws-cloudfront/lib/cache-policy.ts @@ -108,6 +108,16 @@ export class CachePolicy extends Resource implements ICachePolicy { /** Designed for use with an origin that is an AWS Elemental MediaPackage endpoint. */ public static readonly ELEMENTAL_MEDIA_PACKAGE = CachePolicy.fromManagedCachePolicy('08627262-05a9-4f76-9ded-b50ca2e3a84f'); + /** + * Designed for use with an origin that returns Cache-Control HTTP response headers and does not serve different content based on values present in the query string. + */ + public static readonly USE_ORIGIN_CACHE_CONTROL_HEADERS = CachePolicy.fromManagedCachePolicy('83da9c7e-98b4-4e11-a168-04f0df8e2c65'); + + /** + * Designed for use with an origin that returns Cache-Control HTTP response headers and serves different content based on values present in the query string. + */ + public static readonly USE_ORIGIN_CACHE_CONTROL_HEADERS_QUERY_STRINGS = CachePolicy.fromManagedCachePolicy('4cc15a8a-d715-48a4-82b8-cc0b614638fe'); + /** Imports a Cache Policy from its id. */ public static fromCachePolicyId(scope: Construct, id: string, cachePolicyId: string): ICachePolicy { return new class extends Resource implements ICachePolicy {