OriginRequestCookieBehavior
- class aws_cdk.aws_cloudfront.OriginRequestCookieBehavior(*args: Any, **kwargs)
Bases:
object
Determines whether any cookies in viewer requests (and if so, which cookies) are included in requests that CloudFront sends to the origin.
- ExampleMetadata:
infused
Example:
# Creating a custom origin request policy for a Distribution -- all parameters optional # bucket_origin: origins.S3Origin my_origin_request_policy = cloudfront.OriginRequestPolicy(self, "OriginRequestPolicy", origin_request_policy_name="MyPolicy", comment="A default policy", cookie_behavior=cloudfront.OriginRequestCookieBehavior.none(), header_behavior=cloudfront.OriginRequestHeaderBehavior.all("CloudFront-Is-Android-Viewer"), query_string_behavior=cloudfront.OriginRequestQueryStringBehavior.allow_list("username") ) cloudfront.Distribution(self, "myDistCustomPolicy", default_behavior=cloudfront.BehaviorOptions( origin=bucket_origin, origin_request_policy=my_origin_request_policy ) )
Attributes
- behavior
allow all, none or an allow list.
- Type:
The behavior of cookies
- cookies
The cookies to allow, if the behavior is an allow list.
Static Methods
- classmethod all()
All cookies in viewer requests are included in requests that CloudFront sends to the origin.
- Return type:
- classmethod allow_list(*cookies)
Only the provided
cookies
are included in requests that CloudFront sends to the origin.- Parameters:
cookies (
str
) –- Return type:
- classmethod none()
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.
- Return type: