aws-cdk-lib.aws_cloudfront.OriginRequestPolicyProps

interface OriginRequestPolicyProps

LanguageType name
.NETAmazon.CDK.AWS.CloudFront.OriginRequestPolicyProps
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awscloudfront#OriginRequestPolicyProps
Javasoftware.amazon.awscdk.services.cloudfront.OriginRequestPolicyProps
Pythonaws_cdk.aws_cloudfront.OriginRequestPolicyProps
TypeScript (source)aws-cdk-lib » aws_cloudfront » OriginRequestPolicyProps

Properties for creating a Origin Request Policy.

Example

// Creating a custom origin request policy for a Distribution -- all parameters optional
declare const bucketOrigin: origins.S3Origin;
const myOriginRequestPolicy = new cloudfront.OriginRequestPolicy(this, 'OriginRequestPolicy', {
  originRequestPolicyName: 'MyPolicy',
  comment: 'A default policy',
  cookieBehavior: cloudfront.OriginRequestCookieBehavior.none(),
  headerBehavior: cloudfront.OriginRequestHeaderBehavior.all('CloudFront-Is-Android-Viewer'),
  queryStringBehavior: cloudfront.OriginRequestQueryStringBehavior.allowList('username'),
});

new cloudfront.Distribution(this, 'myDistCustomPolicy', {
  defaultBehavior: {
    origin: bucketOrigin,
    originRequestPolicy: myOriginRequestPolicy,
  },
});

Properties

NameTypeDescription
comment?stringA comment to describe the origin request policy.
cookieBehavior?OriginRequestCookieBehaviorThe cookies from viewer requests to include in origin requests.
headerBehavior?OriginRequestHeaderBehaviorThe HTTP headers to include in origin requests.
originRequestPolicyName?stringA unique name to identify the origin request policy.
queryStringBehavior?OriginRequestQueryStringBehaviorThe URL query strings from viewer requests to include in origin requests.

comment?

Type: string (optional, default: no comment)

A comment to describe the origin request policy.


cookieBehavior?

Type: OriginRequestCookieBehavior (optional, default: OriginRequestCookieBehavior.none())

The cookies from viewer requests to include in origin requests.


headerBehavior?

Type: OriginRequestHeaderBehavior (optional, default: OriginRequestHeaderBehavior.none())

The HTTP headers to include in origin requests.

These can include headers from viewer requests and additional headers added by CloudFront.


originRequestPolicyName?

Type: string (optional, default: generated from the id)

A unique name to identify the origin request policy.

The name must only include '-', '_', or alphanumeric characters.


queryStringBehavior?

Type: OriginRequestQueryStringBehavior (optional, default: OriginRequestQueryStringBehavior.none())

The URL query strings from viewer requests to include in origin requests.