Skip to main content

AwsCloudFrontServiceModuleRouteSchema

One route: the paths it claims, the origin serving them, and how CloudFront handles them. Unset settings get defaults that suit the origin's source.

@group

Modules/Service/AwsCloudFrontService

Index

Properties

optionalallowedMethods

allowedMethods?: readonly [GET, HEAD] | readonly [GET, HEAD, OPTIONS] | readonly [GET, HEAD, OPTIONS, PUT, POST, PATCH, DELETE] | null = null

The HTTP methods CloudFront forwards to the origin. For a bucket of static files, GET and HEAD. See ICloudFrontAllowedMethods for the sets CloudFront accepts.

optionalcachedMethods

cachedMethods?: readonly [GET, HEAD] | readonly [GET, HEAD, OPTIONS] | null = null

The subset of allowedMethods whose responses CloudFront caches. For a bucket of static files, GET and HEAD. See ICloudFrontCachedMethods for the sets CloudFront accepts.

optionalcachePolicy

cachePolicy?: ICloudFrontPolicyReference<Managed-CachingDisabled | Managed-CachingOptimized | Managed-CachingOptimizedForUncompressedObjects | UseOriginCacheControlHeaders | UseOriginCacheControlHeaders-QueryStrings> | null = null

Which policy decides the cache key and the TTLs: a managed one by name, e.g. { kind: 'managed', name: 'Managed-CachingOptimized' }, or one of cachePolicies. For a static content bucket, Managed-CachingOptimized. See ICloudFrontManagedCachePolicy for the managed ones.

optionalcompress

compress?: boolean = true

Whether CloudFront compresses the response for viewers that accept it.

optionalfunctionAssociations

functionAssociations?: CloudFrontFunctionAssociationSchema[] = []

Edge functions to run for this route: CloudFront Functions from functions, by functionName.

originId

originId: string

The originId of the origin serving these paths.

optionaloriginRequestPolicy

originRequestPolicy?: ICloudFrontPolicyReference<Managed-AllViewer | Managed-AllViewerAndCloudFrontHeaders-2022-06 | Managed-AllViewerExceptHostHeader | Managed-CORS-CustomOrigin | Managed-CORS-S3Origin | Managed-HostHeaderOnly | Managed-UserAgentRefererHeaders> | null = null

Which policy decides what reaches the origin, independently of the cache key. null forwards only what the cache policy selected. See ICloudFrontManagedOriginRequestPolicy for the managed ones.

optionalpathPattern

pathPattern?: string | null = null

The paths this route claims, e.g. /api/*. Exactly one route leaves it out: the default route, which claims everything the others do not. The others are matched in the order given, and the first match wins.

optionalresponseHeadersPolicy

responseHeadersPolicy?: ICloudFrontPolicyReference<Managed-CORS-and-SecurityHeadersPolicy | Managed-CORS-With-Preflight | Managed-CORS-with-preflight-and-SecurityHeadersPolicy | Managed-SecurityHeadersPolicy | Managed-SimpleCORS> | null = null

Which policy decides the headers CloudFront adds on the way out, such as CORS or HSTS. See ICloudFrontManagedResponseHeadersPolicy for the managed ones.

optionalviewerProtocolPolicy

viewerProtocolPolicy?: allow-all | https-only | redirect-to-https = 'redirect-to-https'

What CloudFront does with a plain HTTP request. See ICloudFrontViewerProtocolPolicy.