Skip to main content

CloudFrontCachePolicySchema

A cache policy this distribution declares, referenced by a behavior under { kind: 'custom', name }. It decides the cache key - what makes two requests different objects - and how long an object stays cached.

Everything in the cache key also reaches the origin. With all three TTLs at 0, nothing is cached. AWS: cache policies.

@group

Resources/CloudFrontDistribution

Index

Properties

optionalcookies

cookies?: ICloudFrontValueSelection = { kind: 'none' }

Which cookies are part of the cache key. See ICloudFrontValueSelection.

optionaldefaultTtl

defaultTtl?: number = 86400

How long an object stays cached when the origin sent neither Cache-Control nor Expires, in seconds.

optionalenableBrotli

enableBrotli?: boolean = true

Whether CloudFront caches a brotli-compressed copy for viewers that accept one. A behavior's compress serves brotli only when this is true.

optionalenableGzip

enableGzip?: boolean = true

Whether CloudFront caches a gzip-compressed copy for viewers that accept one. A behavior's compress serves gzip only when this is true.

optionalheaders

headers?: ICloudFrontValueSelection = { kind: 'none' }

Which request headers are part of the cache key. See ICloudFrontValueSelection.

optionalmaxTtl

maxTtl?: number = 31536000

The longest an object stays cached when the origin's Cache-Control or Expires asks for longer, in seconds.

optionalminTtl

minTtl?: number = 1

The shortest an object stays cached, in seconds. Above 0, it holds even when the origin sends no-cache, no-store, or private.

name

name: string

How a behavior names this policy. It is also the policy's name in AWS, which must be unique across the account.

optionalqueryStrings

queryStrings?: ICloudFrontValueSelection = { kind: 'none' }

Which query strings are part of the cache key. Their order matters too: ?a=1&b=2 and ?b=2&a=1 are cached apart. See ICloudFrontValueSelection.