class OriginRequestCookieBehavior
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.CloudFront.OriginRequestCookieBehavior |
![]() | github.com/aws/aws-cdk-go/awscdk/v2/awscloudfront#OriginRequestCookieBehavior |
![]() | software.amazon.awscdk.services.cloudfront.OriginRequestCookieBehavior |
![]() | aws_cdk.aws_cloudfront.OriginRequestCookieBehavior |
![]() | aws-cdk-lib » aws_cloudfront » OriginRequestCookieBehavior |
Determines whether any cookies in viewer requests (and if so, which cookies) are included in requests that CloudFront sends to the origin.
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 |
---|---|---|
behavior | string | The behavior of cookies: allow all, none or an allow list. |
cookies? | string[] | The cookies to allow, if the behavior is an allow list. |
behavior
Type:
string
The behavior of cookies: allow all, none or an allow list.
cookies?
Type:
string[]
(optional)
The cookies to allow, if the behavior is an allow list.
Methods
Name | Description |
---|---|
static all() | All cookies in viewer requests are included in requests that CloudFront sends to the origin. |
static allow | Only the provided cookies are included in requests that CloudFront sends to the origin. |
static deny | All cookies except the provided cookies are included in requests that CloudFront sends to the origin. |
static none() | Cookies in viewer requests are not included in requests that CloudFront sends to the origin. |
static all()
public static all(): OriginRequestCookieBehavior
Returns
All cookies in viewer requests are included in requests that CloudFront sends to the origin.
static allowList(...cookies)
public static allowList(...cookies: string[]): OriginRequestCookieBehavior
Parameters
- cookies
string
Returns
Only the provided cookies
are included in requests that CloudFront sends to the origin.
static denyList(...cookies)
public static denyList(...cookies: string[]): OriginRequestCookieBehavior
Parameters
- cookies
string
Returns
All cookies except the provided cookies
are included in requests that CloudFront sends to the origin.
static none()
public static none(): OriginRequestCookieBehavior
Returns
Cookies in viewer requests are not included in requests that CloudFront sends to the origin.
Any cookies that are listed in a CachePolicy are still included in origin requests.