interface OriginRequestPolicyProps
Language | Type name |
---|---|
.NET | Amazon.CDK.AWS.CloudFront.OriginRequestPolicyProps |
Java | software.amazon.awscdk.services.cloudfront.OriginRequestPolicyProps |
Python | aws_cdk.aws_cloudfront.OriginRequestPolicyProps |
TypeScript (source) | @aws-cdk/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
Name | Type | Description |
---|---|---|
comment? | string | A comment to describe the origin request policy. |
cookie | Origin | The cookies from viewer requests to include in origin requests. |
header | Origin | The HTTP headers to include in origin requests. |
origin | string | A unique name to identify the origin request policy. |
query | Origin | The 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:
Origin
(optional, default: OriginRequestCookieBehavior.none())
The cookies from viewer requests to include in origin requests.
headerBehavior?
Type:
Origin
(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:
Origin
(optional, default: OriginRequestQueryStringBehavior.none())
The URL query strings from viewer requests to include in origin requests.