OriginRequestHeaderBehavior
- class aws_cdk.aws_cloudfront.OriginRequestHeaderBehavior(*args: Any, **kwargs)
Bases:
object
Determines whether any HTTP headers (and if so, which headers) 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 headers
- headers
The headers for the allow list or the included CloudFront headers, if applicable.
Static Methods
- classmethod all(*cloudfront_headers)
All HTTP headers in viewer requests are included in requests that CloudFront sends to the origin.
Additionally, any additional CloudFront headers provided are included; the additional headers are added by CloudFront.
- Parameters:
cloudfront_headers (
str
) –- See:
https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/using-cloudfront-headers.html
- Return type:
- classmethod allow_list(*headers)
Listed headers are included in requests that CloudFront sends to the origin.
- Parameters:
headers (
str
) –- Return type:
- classmethod deny_list(*headers)
All headers except the provided
headers
are included in requests that CloudFront sends to the origin.- Parameters:
headers (
str
) –- Return type:
- classmethod none()
HTTP headers are not included in requests that CloudFront sends to the origin.
Any headers that are listed in a CachePolicy are still included in origin requests.
- Return type: