CfnResponseHeadersPolicy
- class aws_cdk.aws_cloudfront.CfnResponseHeadersPolicy(scope, id, *, response_headers_policy_config)
Bases:
CfnResource
A CloudFormation
AWS::CloudFront::ResponseHeadersPolicy
.A response headers policy.
A response headers policy contains information about a set of HTTP response headers.
After you create a response headers policy, you can use its ID to attach it to one or more cache behaviors in a CloudFront distribution. When it’s attached to a cache behavior, the response headers policy affects the HTTP headers that CloudFront includes in HTTP responses to requests that match the cache behavior. CloudFront adds or removes response headers according to the configuration of the response headers policy.
For more information, see Adding or removing HTTP headers in CloudFront responses in the Amazon CloudFront Developer Guide .
- CloudformationResource:
AWS::CloudFront::ResponseHeadersPolicy
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_cloudfront as cloudfront cfn_response_headers_policy = cloudfront.CfnResponseHeadersPolicy(self, "MyCfnResponseHeadersPolicy", response_headers_policy_config=cloudfront.CfnResponseHeadersPolicy.ResponseHeadersPolicyConfigProperty( name="name", # the properties below are optional comment="comment", cors_config=cloudfront.CfnResponseHeadersPolicy.CorsConfigProperty( access_control_allow_credentials=False, access_control_allow_headers=cloudfront.CfnResponseHeadersPolicy.AccessControlAllowHeadersProperty( items=["items"] ), access_control_allow_methods=cloudfront.CfnResponseHeadersPolicy.AccessControlAllowMethodsProperty( items=["items"] ), access_control_allow_origins=cloudfront.CfnResponseHeadersPolicy.AccessControlAllowOriginsProperty( items=["items"] ), origin_override=False, # the properties below are optional access_control_expose_headers=cloudfront.CfnResponseHeadersPolicy.AccessControlExposeHeadersProperty( items=["items"] ), access_control_max_age_sec=123 ), custom_headers_config=cloudfront.CfnResponseHeadersPolicy.CustomHeadersConfigProperty( items=[cloudfront.CfnResponseHeadersPolicy.CustomHeaderProperty( header="header", override=False, value="value" )] ), remove_headers_config=cloudfront.CfnResponseHeadersPolicy.RemoveHeadersConfigProperty( items=[cloudfront.CfnResponseHeadersPolicy.RemoveHeaderProperty( header="header" )] ), security_headers_config=cloudfront.CfnResponseHeadersPolicy.SecurityHeadersConfigProperty( content_security_policy=cloudfront.CfnResponseHeadersPolicy.ContentSecurityPolicyProperty( content_security_policy="contentSecurityPolicy", override=False ), content_type_options=cloudfront.CfnResponseHeadersPolicy.ContentTypeOptionsProperty( override=False ), frame_options=cloudfront.CfnResponseHeadersPolicy.FrameOptionsProperty( frame_option="frameOption", override=False ), referrer_policy=cloudfront.CfnResponseHeadersPolicy.ReferrerPolicyProperty( override=False, referrer_policy="referrerPolicy" ), strict_transport_security=cloudfront.CfnResponseHeadersPolicy.StrictTransportSecurityProperty( access_control_max_age_sec=123, override=False, # the properties below are optional include_subdomains=False, preload=False ), xss_protection=cloudfront.CfnResponseHeadersPolicy.XSSProtectionProperty( override=False, protection=False, # the properties below are optional mode_block=False, report_uri="reportUri" ) ), server_timing_headers_config=cloudfront.CfnResponseHeadersPolicy.ServerTimingHeadersConfigProperty( enabled=False, # the properties below are optional sampling_rate=123 ) ) )
Create a new
AWS::CloudFront::ResponseHeadersPolicy
.- Parameters:
scope (
Construct
) –scope in which this resource is defined.
id (
str
) –scoped id of the resource.
response_headers_policy_config (
Union
[IResolvable
,ResponseHeadersPolicyConfigProperty
,Dict
[str
,Any
]]) – A response headers policy configuration.
Methods
- add_deletion_override(path)
Syntactic sugar for
addOverride(path, undefined)
.- Parameters:
path (
str
) – The path of the value to delete.- Return type:
None
- add_depends_on(target)
Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.
This can be used for resources across stacks (or nested stack) boundaries and the dependency will automatically be transferred to the relevant scope.
- Parameters:
target (
CfnResource
) –- Return type:
None
- add_metadata(key, value)
Add a value to the CloudFormation Resource Metadata.
- Parameters:
key (
str
) –value (
Any
) –
- See:
- Return type:
None
Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.
- add_override(path, value)
Adds an override to the synthesized CloudFormation resource.
To add a property override, either use
addPropertyOverride
or prefixpath
with “Properties.” (i.e.Properties.TopicName
).If the override is nested, separate each nested level using a dot (.) in the path parameter. If there is an array as part of the nesting, specify the index in the path.
To include a literal
.
in the property name, prefix with a\
. In most programming languages you will need to write this as"\\."
because the\
itself will need to be escaped.For example:
cfn_resource.add_override("Properties.GlobalSecondaryIndexes.0.Projection.NonKeyAttributes", ["myattribute"]) cfn_resource.add_override("Properties.GlobalSecondaryIndexes.1.ProjectionType", "INCLUDE")
would add the overrides Example:
"Properties": { "GlobalSecondaryIndexes": [ { "Projection": { "NonKeyAttributes": [ "myattribute" ] ... } ... }, { "ProjectionType": "INCLUDE" ... }, ] ... }
The
value
argument toaddOverride
will not be processed or translated in any way. Pass raw JSON values in here with the correct capitalization for CloudFormation. If you pass CDK classes or structs, they will be rendered with lowercased key names, and CloudFormation will reject the template.- Parameters:
path (
str
) –The path of the property, you can use dot notation to override values in complex types. Any intermdediate keys will be created as needed.
value (
Any
) –The value. Could be primitive or complex.
- Return type:
None
- add_property_deletion_override(property_path)
Adds an override that deletes the value of a property from the resource definition.
- Parameters:
property_path (
str
) – The path to the property.- Return type:
None
- add_property_override(property_path, value)
Adds an override to a resource property.
Syntactic sugar for
addOverride("Properties.<...>", value)
.- Parameters:
property_path (
str
) – The path of the property.value (
Any
) – The value.
- Return type:
None
- apply_removal_policy(policy=None, *, apply_to_update_replace_policy=None, default=None)
Sets the deletion policy of the resource based on the removal policy specified.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you’ve removed it from the CDK application or because you’ve made a change that requires the resource to be replaced.
The resource can be deleted (
RemovalPolicy.DESTROY
), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN
).- Parameters:
policy (
Optional
[RemovalPolicy
]) –apply_to_update_replace_policy (
Optional
[bool
]) – Apply the same deletion policy to the resource’s “UpdateReplacePolicy”. Default: truedefault (
Optional
[RemovalPolicy
]) – The default policy to apply in case the removal policy is not defined. Default: - Default value is resource specific. To determine the default value for a resoure, please consult that specific resource’s documentation.
- Return type:
None
- get_att(attribute_name)
Returns a token for an runtime attribute of this resource.
Ideally, use generated attribute accessors (e.g.
resource.arn
), but this can be used for future compatibility in case there is no generated attribute.- Parameters:
attribute_name (
str
) – The name of the attribute.- Return type:
- get_metadata(key)
Retrieve a value value from the CloudFormation Resource Metadata.
- Parameters:
key (
str
) –- See:
- Return type:
Any
Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.
- inspect(inspector)
Examines the CloudFormation resource and discloses attributes.
- Parameters:
inspector (
TreeInspector
) –tree inspector to collect and process attributes.
- Return type:
None
- override_logical_id(new_logical_id)
Overrides the auto-generated logical ID with a specific ID.
- Parameters:
new_logical_id (
str
) – The new logical ID to use for this stack element.- Return type:
None
- to_string()
Returns a string representation of this construct.
- Return type:
str
- Returns:
a string representation of this resource
Attributes
- CFN_RESOURCE_TYPE_NAME = 'AWS::CloudFront::ResponseHeadersPolicy'
- attr_id
The unique identifier for the response headers policy.
For example:
57f99797-3b20-4e1b-a728-27972a74082a
.- CloudformationAttribute:
Id
- attr_last_modified_time
The date and time when the response headers policy was last modified.
- CloudformationAttribute:
LastModifiedTime
- cfn_options
Options for this resource, such as condition, update policy etc.
- cfn_resource_type
AWS resource type.
- creation_stack
return:
the stack trace of the point where this Resource was created from, sourced from the +metadata+ entry typed +aws:cdk:logicalId+, and with the bottom-most node +internal+ entries filtered.
- logical_id
The logical ID for this CloudFormation stack element.
The logical ID of the element is calculated from the path of the resource node in the construct tree.
To override this value, use
overrideLogicalId(newLogicalId)
.- Returns:
the logical ID as a stringified token. This value will only get resolved during synthesis.
- node
The construct tree node associated with this construct.
- ref
Return a string that will be resolved to a CloudFormation
{ Ref }
for this element.If, by any chance, the intrinsic reference of a resource is not a string, you could coerce it to an IResolvable through
Lazy.any({ produce: resource.ref })
.
- response_headers_policy_config
A response headers policy configuration.
- stack
The stack in which this element is defined.
CfnElements must be defined within a stack scope (directly or indirectly).
Static Methods
- classmethod is_cfn_element(x)
Returns
true
if a construct is a stack element (i.e. part of the synthesized cloudformation template).Uses duck-typing instead of
instanceof
to allow stack elements from different versions of this library to be included in the same stack.- Parameters:
x (
Any
) –- Return type:
bool
- Returns:
The construct as a stack element or undefined if it is not a stack element.
- classmethod is_cfn_resource(construct)
Check whether the given construct is a CfnResource.
- Parameters:
construct (
IConstruct
) –- Return type:
bool
- classmethod is_construct(x)
Return whether the given object is a Construct.
- Parameters:
x (
Any
) –- Return type:
bool
AccessControlAllowHeadersProperty
- class CfnResponseHeadersPolicy.AccessControlAllowHeadersProperty(*, items)
Bases:
object
A list of HTTP header names that CloudFront includes as values for the
Access-Control-Allow-Headers
HTTP response header.For more information about the
Access-Control-Allow-Headers
HTTP response header, see Access-Control-Allow-Headers in the MDN Web Docs.- Parameters:
items (
Sequence
[str
]) – The list of HTTP header names. You can specify*
to allow all headers.- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_cloudfront as cloudfront access_control_allow_headers_property = cloudfront.CfnResponseHeadersPolicy.AccessControlAllowHeadersProperty( items=["items"] )
Attributes
- items
The list of HTTP header names.
You can specify
*
to allow all headers.
AccessControlAllowMethodsProperty
- class CfnResponseHeadersPolicy.AccessControlAllowMethodsProperty(*, items)
Bases:
object
A list of HTTP methods that CloudFront includes as values for the
Access-Control-Allow-Methods
HTTP response header.For more information about the
Access-Control-Allow-Methods
HTTP response header, see Access-Control-Allow-Methods in the MDN Web Docs.- Parameters:
items (
Sequence
[str
]) – The list of HTTP methods. Valid values are:. -GET
-DELETE
-HEAD
-OPTIONS
-PATCH
-POST
-PUT
-ALL
ALL
is a special value that includes all of the listed HTTP methods.- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_cloudfront as cloudfront access_control_allow_methods_property = cloudfront.CfnResponseHeadersPolicy.AccessControlAllowMethodsProperty( items=["items"] )
Attributes
- items
.
GET
DELETE
HEAD
OPTIONS
PATCH
POST
PUT
ALL
ALL
is a special value that includes all of the listed HTTP methods.- Link:
- Type:
The list of HTTP methods. Valid values are
AccessControlAllowOriginsProperty
- class CfnResponseHeadersPolicy.AccessControlAllowOriginsProperty(*, items)
Bases:
object
A list of origins (domain names) that CloudFront can use as the value for the
Access-Control-Allow-Origin
HTTP response header.For more information about the
Access-Control-Allow-Origin
HTTP response header, see Access-Control-Allow-Origin in the MDN Web Docs.- Parameters:
items (
Sequence
[str
]) – The list of origins (domain names). You can specify*
to allow all origins.- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_cloudfront as cloudfront access_control_allow_origins_property = cloudfront.CfnResponseHeadersPolicy.AccessControlAllowOriginsProperty( items=["items"] )
Attributes
- items
The list of origins (domain names).
You can specify
*
to allow all origins.
AccessControlExposeHeadersProperty
- class CfnResponseHeadersPolicy.AccessControlExposeHeadersProperty(*, items)
Bases:
object
A list of HTTP headers that CloudFront includes as values for the
Access-Control-Expose-Headers
HTTP response header.For more information about the
Access-Control-Expose-Headers
HTTP response header, see Access-Control-Expose-Headers in the MDN Web Docs.- Parameters:
items (
Sequence
[str
]) – The list of HTTP headers. You can specify*
to expose all headers.- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_cloudfront as cloudfront access_control_expose_headers_property = cloudfront.CfnResponseHeadersPolicy.AccessControlExposeHeadersProperty( items=["items"] )
Attributes
- items
The list of HTTP headers.
You can specify
*
to expose all headers.
ContentSecurityPolicyProperty
- class CfnResponseHeadersPolicy.ContentSecurityPolicyProperty(*, content_security_policy, override)
Bases:
object
The policy directives and their values that CloudFront includes as values for the
Content-Security-Policy
HTTP response header.For more information about the
Content-Security-Policy
HTTP response header, see Content-Security-Policy in the MDN Web Docs.- Parameters:
content_security_policy (
str
) – The policy directives and their values that CloudFront includes as values for theContent-Security-Policy
HTTP response header.override (
Union
[bool
,IResolvable
]) – A Boolean that determines whether CloudFront overrides theContent-Security-Policy
HTTP response header received from the origin with the one specified in this response headers policy.
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_cloudfront as cloudfront content_security_policy_property = cloudfront.CfnResponseHeadersPolicy.ContentSecurityPolicyProperty( content_security_policy="contentSecurityPolicy", override=False )
Attributes
- content_security_policy
The policy directives and their values that CloudFront includes as values for the
Content-Security-Policy
HTTP response header.
- override
A Boolean that determines whether CloudFront overrides the
Content-Security-Policy
HTTP response header received from the origin with the one specified in this response headers policy.
ContentTypeOptionsProperty
- class CfnResponseHeadersPolicy.ContentTypeOptionsProperty(*, override)
Bases:
object
Determines whether CloudFront includes the
X-Content-Type-Options
HTTP response header with its value set tonosniff
.For more information about the
X-Content-Type-Options
HTTP response header, see X-Content-Type-Options in the MDN Web Docs.- Parameters:
override (
Union
[bool
,IResolvable
]) – A Boolean that determines whether CloudFront overrides theX-Content-Type-Options
HTTP response header received from the origin with the one specified in this response headers policy.- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_cloudfront as cloudfront content_type_options_property = cloudfront.CfnResponseHeadersPolicy.ContentTypeOptionsProperty( override=False )
Attributes
- override
A Boolean that determines whether CloudFront overrides the
X-Content-Type-Options
HTTP response header received from the origin with the one specified in this response headers policy.
CorsConfigProperty
- class CfnResponseHeadersPolicy.CorsConfigProperty(*, access_control_allow_credentials, access_control_allow_headers, access_control_allow_methods, access_control_allow_origins, origin_override, access_control_expose_headers=None, access_control_max_age_sec=None)
Bases:
object
A configuration for a set of HTTP response headers that are used for cross-origin resource sharing (CORS).
CloudFront adds these headers to HTTP responses that it sends for CORS requests that match a cache behavior associated with this response headers policy.
For more information about CORS, see Cross-Origin Resource Sharing (CORS) in the MDN Web Docs.
- Parameters:
access_control_allow_credentials (
Union
[bool
,IResolvable
]) – A Boolean that CloudFront uses as the value for theAccess-Control-Allow-Credentials
HTTP response header. For more information about theAccess-Control-Allow-Credentials
HTTP response header, see Access-Control-Allow-Credentials in the MDN Web Docs.access_control_allow_headers (
Union
[IResolvable
,AccessControlAllowHeadersProperty
,Dict
[str
,Any
]]) –A list of HTTP header names that CloudFront includes as values for the
Access-Control-Allow-Headers
HTTP response header. For more information about theAccess-Control-Allow-Headers
HTTP response header, see Access-Control-Allow-Headers in the MDN Web Docs.access_control_allow_methods (
Union
[IResolvable
,AccessControlAllowMethodsProperty
,Dict
[str
,Any
]]) –A list of HTTP methods that CloudFront includes as values for the
Access-Control-Allow-Methods
HTTP response header. For more information about theAccess-Control-Allow-Methods
HTTP response header, see Access-Control-Allow-Methods in the MDN Web Docs.access_control_allow_origins (
Union
[IResolvable
,AccessControlAllowOriginsProperty
,Dict
[str
,Any
]]) –A list of origins (domain names) that CloudFront can use as the value for the
Access-Control-Allow-Origin
HTTP response header. For more information about theAccess-Control-Allow-Origin
HTTP response header, see Access-Control-Allow-Origin in the MDN Web Docs.origin_override (
Union
[bool
,IResolvable
]) – A Boolean that determines whether CloudFront overrides HTTP response headers received from the origin with the ones specified in this response headers policy.access_control_expose_headers (
Union
[IResolvable
,AccessControlExposeHeadersProperty
,Dict
[str
,Any
],None
]) –A list of HTTP headers that CloudFront includes as values for the
Access-Control-Expose-Headers
HTTP response header. For more information about theAccess-Control-Expose-Headers
HTTP response header, see Access-Control-Expose-Headers in the MDN Web Docs.access_control_max_age_sec (
Union
[int
,float
,None
]) – A number that CloudFront uses as the value for theAccess-Control-Max-Age
HTTP response header. For more information about theAccess-Control-Max-Age
HTTP response header, see Access-Control-Max-Age in the MDN Web Docs.
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_cloudfront as cloudfront cors_config_property = cloudfront.CfnResponseHeadersPolicy.CorsConfigProperty( access_control_allow_credentials=False, access_control_allow_headers=cloudfront.CfnResponseHeadersPolicy.AccessControlAllowHeadersProperty( items=["items"] ), access_control_allow_methods=cloudfront.CfnResponseHeadersPolicy.AccessControlAllowMethodsProperty( items=["items"] ), access_control_allow_origins=cloudfront.CfnResponseHeadersPolicy.AccessControlAllowOriginsProperty( items=["items"] ), origin_override=False, # the properties below are optional access_control_expose_headers=cloudfront.CfnResponseHeadersPolicy.AccessControlExposeHeadersProperty( items=["items"] ), access_control_max_age_sec=123 )
Attributes
- access_control_allow_credentials
A Boolean that CloudFront uses as the value for the
Access-Control-Allow-Credentials
HTTP response header.For more information about the
Access-Control-Allow-Credentials
HTTP response header, see Access-Control-Allow-Credentials in the MDN Web Docs.
- access_control_allow_headers
A list of HTTP header names that CloudFront includes as values for the
Access-Control-Allow-Headers
HTTP response header.For more information about the
Access-Control-Allow-Headers
HTTP response header, see Access-Control-Allow-Headers in the MDN Web Docs.
- access_control_allow_methods
A list of HTTP methods that CloudFront includes as values for the
Access-Control-Allow-Methods
HTTP response header.For more information about the
Access-Control-Allow-Methods
HTTP response header, see Access-Control-Allow-Methods in the MDN Web Docs.
- access_control_allow_origins
A list of origins (domain names) that CloudFront can use as the value for the
Access-Control-Allow-Origin
HTTP response header.For more information about the
Access-Control-Allow-Origin
HTTP response header, see Access-Control-Allow-Origin in the MDN Web Docs.
- access_control_expose_headers
A list of HTTP headers that CloudFront includes as values for the
Access-Control-Expose-Headers
HTTP response header.For more information about the
Access-Control-Expose-Headers
HTTP response header, see Access-Control-Expose-Headers in the MDN Web Docs.
- access_control_max_age_sec
A number that CloudFront uses as the value for the
Access-Control-Max-Age
HTTP response header.For more information about the
Access-Control-Max-Age
HTTP response header, see Access-Control-Max-Age in the MDN Web Docs.
- origin_override
A Boolean that determines whether CloudFront overrides HTTP response headers received from the origin with the ones specified in this response headers policy.
CustomHeaderProperty
- class CfnResponseHeadersPolicy.CustomHeaderProperty(*, header, override, value)
Bases:
object
An HTTP response header name and its value.
CloudFront includes this header in HTTP responses that it sends for requests that match a cache behavior that’s associated with this response headers policy.
- Parameters:
header (
str
) – The HTTP response header name.override (
Union
[bool
,IResolvable
]) – A Boolean that determines whether CloudFront overrides a response header with the same name received from the origin with the header specified here.value (
str
) – The value for the HTTP response header.
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_cloudfront as cloudfront custom_header_property = cloudfront.CfnResponseHeadersPolicy.CustomHeaderProperty( header="header", override=False, value="value" )
Attributes
- header
The HTTP response header name.
- override
A Boolean that determines whether CloudFront overrides a response header with the same name received from the origin with the header specified here.
- value
The value for the HTTP response header.
CustomHeadersConfigProperty
- class CfnResponseHeadersPolicy.CustomHeadersConfigProperty(*, items)
Bases:
object
A list of HTTP response header names and their values.
CloudFront includes these headers in HTTP responses that it sends for requests that match a cache behavior that’s associated with this response headers policy.
- Parameters:
items (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,CustomHeaderProperty
,Dict
[str
,Any
]]]]) – The list of HTTP response headers and their values.- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_cloudfront as cloudfront custom_headers_config_property = cloudfront.CfnResponseHeadersPolicy.CustomHeadersConfigProperty( items=[cloudfront.CfnResponseHeadersPolicy.CustomHeaderProperty( header="header", override=False, value="value" )] )
Attributes
- items
The list of HTTP response headers and their values.
FrameOptionsProperty
- class CfnResponseHeadersPolicy.FrameOptionsProperty(*, frame_option, override)
Bases:
object
Determines whether CloudFront includes the
X-Frame-Options
HTTP response header and the header’s value.For more information about the
X-Frame-Options
HTTP response header, see X-Frame-Options in the MDN Web Docs.- Parameters:
frame_option (
str
) –The value of the
X-Frame-Options
HTTP response header. Valid values areDENY
andSAMEORIGIN
. For more information about these values, see X-Frame-Options in the MDN Web Docs.override (
Union
[bool
,IResolvable
]) – A Boolean that determines whether CloudFront overrides theX-Frame-Options
HTTP response header received from the origin with the one specified in this response headers policy.
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_cloudfront as cloudfront frame_options_property = cloudfront.CfnResponseHeadersPolicy.FrameOptionsProperty( frame_option="frameOption", override=False )
Attributes
- frame_option
The value of the
X-Frame-Options
HTTP response header. Valid values areDENY
andSAMEORIGIN
.For more information about these values, see X-Frame-Options in the MDN Web Docs.
- override
A Boolean that determines whether CloudFront overrides the
X-Frame-Options
HTTP response header received from the origin with the one specified in this response headers policy.
ReferrerPolicyProperty
- class CfnResponseHeadersPolicy.ReferrerPolicyProperty(*, override, referrer_policy)
Bases:
object
Determines whether CloudFront includes the
Referrer-Policy
HTTP response header and the header’s value.For more information about the
Referrer-Policy
HTTP response header, see Referrer-Policy in the MDN Web Docs.- Parameters:
override (
Union
[bool
,IResolvable
]) – A Boolean that determines whether CloudFront overrides theReferrer-Policy
HTTP response header received from the origin with the one specified in this response headers policy.referrer_policy (
str
) –The value of the
Referrer-Policy
HTTP response header. Valid values are:. -no-referrer
-no-referrer-when-downgrade
-origin
-origin-when-cross-origin
-same-origin
-strict-origin
-strict-origin-when-cross-origin
-unsafe-url
For more information about these values, see Referrer-Policy in the MDN Web Docs.
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_cloudfront as cloudfront referrer_policy_property = cloudfront.CfnResponseHeadersPolicy.ReferrerPolicyProperty( override=False, referrer_policy="referrerPolicy" )
Attributes
- override
A Boolean that determines whether CloudFront overrides the
Referrer-Policy
HTTP response header received from the origin with the one specified in this response headers policy.
- referrer_policy
.
no-referrer
no-referrer-when-downgrade
origin
origin-when-cross-origin
same-origin
strict-origin
strict-origin-when-cross-origin
unsafe-url
For more information about these values, see Referrer-Policy in the MDN Web Docs.
- Link:
- Type:
The value of the
Referrer-Policy
HTTP response header. Valid values are
RemoveHeaderProperty
- class CfnResponseHeadersPolicy.RemoveHeaderProperty(*, header)
Bases:
object
The name of an HTTP header that CloudFront removes from HTTP responses to requests that match the cache behavior that this response headers policy is attached to.
- Parameters:
header (
str
) – The HTTP header name.- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_cloudfront as cloudfront remove_header_property = cloudfront.CfnResponseHeadersPolicy.RemoveHeaderProperty( header="header" )
Attributes
RemoveHeadersConfigProperty
- class CfnResponseHeadersPolicy.RemoveHeadersConfigProperty(*, items)
Bases:
object
A list of HTTP header names that CloudFront removes from HTTP responses to requests that match the cache behavior that this response headers policy is attached to.
- Parameters:
items (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,RemoveHeaderProperty
,Dict
[str
,Any
]]]]) – The list of HTTP header names.- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_cloudfront as cloudfront remove_headers_config_property = cloudfront.CfnResponseHeadersPolicy.RemoveHeadersConfigProperty( items=[cloudfront.CfnResponseHeadersPolicy.RemoveHeaderProperty( header="header" )] )
Attributes
ResponseHeadersPolicyConfigProperty
- class CfnResponseHeadersPolicy.ResponseHeadersPolicyConfigProperty(*, name, comment=None, cors_config=None, custom_headers_config=None, remove_headers_config=None, security_headers_config=None, server_timing_headers_config=None)
Bases:
object
A response headers policy configuration.
A response headers policy configuration contains metadata about the response headers policy, and configurations for sets of HTTP response headers.
- Parameters:
name (
str
) – A name to identify the response headers policy. The name must be unique for response headers policies in this AWS account .comment (
Optional
[str
]) – A comment to describe the response headers policy. The comment cannot be longer than 128 characters.cors_config (
Union
[IResolvable
,CorsConfigProperty
,Dict
[str
,Any
],None
]) – A configuration for a set of HTTP response headers that are used for cross-origin resource sharing (CORS).custom_headers_config (
Union
[IResolvable
,CustomHeadersConfigProperty
,Dict
[str
,Any
],None
]) – A configuration for a set of custom HTTP response headers.remove_headers_config (
Union
[IResolvable
,RemoveHeadersConfigProperty
,Dict
[str
,Any
],None
]) – A configuration for a set of HTTP headers to remove from the HTTP response.security_headers_config (
Union
[IResolvable
,SecurityHeadersConfigProperty
,Dict
[str
,Any
],None
]) – A configuration for a set of security-related HTTP response headers.server_timing_headers_config (
Union
[IResolvable
,ServerTimingHeadersConfigProperty
,Dict
[str
,Any
],None
]) – A configuration for enabling theServer-Timing
header in HTTP responses sent from CloudFront.
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_cloudfront as cloudfront response_headers_policy_config_property = cloudfront.CfnResponseHeadersPolicy.ResponseHeadersPolicyConfigProperty( name="name", # the properties below are optional comment="comment", cors_config=cloudfront.CfnResponseHeadersPolicy.CorsConfigProperty( access_control_allow_credentials=False, access_control_allow_headers=cloudfront.CfnResponseHeadersPolicy.AccessControlAllowHeadersProperty( items=["items"] ), access_control_allow_methods=cloudfront.CfnResponseHeadersPolicy.AccessControlAllowMethodsProperty( items=["items"] ), access_control_allow_origins=cloudfront.CfnResponseHeadersPolicy.AccessControlAllowOriginsProperty( items=["items"] ), origin_override=False, # the properties below are optional access_control_expose_headers=cloudfront.CfnResponseHeadersPolicy.AccessControlExposeHeadersProperty( items=["items"] ), access_control_max_age_sec=123 ), custom_headers_config=cloudfront.CfnResponseHeadersPolicy.CustomHeadersConfigProperty( items=[cloudfront.CfnResponseHeadersPolicy.CustomHeaderProperty( header="header", override=False, value="value" )] ), remove_headers_config=cloudfront.CfnResponseHeadersPolicy.RemoveHeadersConfigProperty( items=[cloudfront.CfnResponseHeadersPolicy.RemoveHeaderProperty( header="header" )] ), security_headers_config=cloudfront.CfnResponseHeadersPolicy.SecurityHeadersConfigProperty( content_security_policy=cloudfront.CfnResponseHeadersPolicy.ContentSecurityPolicyProperty( content_security_policy="contentSecurityPolicy", override=False ), content_type_options=cloudfront.CfnResponseHeadersPolicy.ContentTypeOptionsProperty( override=False ), frame_options=cloudfront.CfnResponseHeadersPolicy.FrameOptionsProperty( frame_option="frameOption", override=False ), referrer_policy=cloudfront.CfnResponseHeadersPolicy.ReferrerPolicyProperty( override=False, referrer_policy="referrerPolicy" ), strict_transport_security=cloudfront.CfnResponseHeadersPolicy.StrictTransportSecurityProperty( access_control_max_age_sec=123, override=False, # the properties below are optional include_subdomains=False, preload=False ), xss_protection=cloudfront.CfnResponseHeadersPolicy.XSSProtectionProperty( override=False, protection=False, # the properties below are optional mode_block=False, report_uri="reportUri" ) ), server_timing_headers_config=cloudfront.CfnResponseHeadersPolicy.ServerTimingHeadersConfigProperty( enabled=False, # the properties below are optional sampling_rate=123 ) )
Attributes
- comment
A comment to describe the response headers policy.
The comment cannot be longer than 128 characters.
- cors_config
A configuration for a set of HTTP response headers that are used for cross-origin resource sharing (CORS).
- custom_headers_config
A configuration for a set of custom HTTP response headers.
- name
A name to identify the response headers policy.
The name must be unique for response headers policies in this AWS account .
- remove_headers_config
A configuration for a set of HTTP headers to remove from the HTTP response.
- security_headers_config
A configuration for a set of security-related HTTP response headers.
- server_timing_headers_config
A configuration for enabling the
Server-Timing
header in HTTP responses sent from CloudFront.
SecurityHeadersConfigProperty
- class CfnResponseHeadersPolicy.SecurityHeadersConfigProperty(*, content_security_policy=None, content_type_options=None, frame_options=None, referrer_policy=None, strict_transport_security=None, xss_protection=None)
Bases:
object
A configuration for a set of security-related HTTP response headers.
CloudFront adds these headers to HTTP responses that it sends for requests that match a cache behavior associated with this response headers policy.
- Parameters:
content_security_policy (
Union
[IResolvable
,ContentSecurityPolicyProperty
,Dict
[str
,Any
],None
]) –The policy directives and their values that CloudFront includes as values for the
Content-Security-Policy
HTTP response header. For more information about theContent-Security-Policy
HTTP response header, see Content-Security-Policy in the MDN Web Docs.content_type_options (
Union
[IResolvable
,ContentTypeOptionsProperty
,Dict
[str
,Any
],None
]) –Determines whether CloudFront includes the
X-Content-Type-Options
HTTP response header with its value set tonosniff
. For more information about theX-Content-Type-Options
HTTP response header, see X-Content-Type-Options in the MDN Web Docs.frame_options (
Union
[IResolvable
,FrameOptionsProperty
,Dict
[str
,Any
],None
]) –Determines whether CloudFront includes the
X-Frame-Options
HTTP response header and the header’s value. For more information about theX-Frame-Options
HTTP response header, see X-Frame-Options in the MDN Web Docs.referrer_policy (
Union
[IResolvable
,ReferrerPolicyProperty
,Dict
[str
,Any
],None
]) –Determines whether CloudFront includes the
Referrer-Policy
HTTP response header and the header’s value. For more information about theReferrer-Policy
HTTP response header, see Referrer-Policy in the MDN Web Docs.strict_transport_security (
Union
[IResolvable
,StrictTransportSecurityProperty
,Dict
[str
,Any
],None
]) – Determines whether CloudFront includes theStrict-Transport-Security
HTTP response header and the header’s value. For more information about theStrict-Transport-Security
HTTP response header, see Strict-Transport-Security in the MDN Web Docs.xss_protection (
Union
[IResolvable
,XSSProtectionProperty
,Dict
[str
,Any
],None
]) – Determines whether CloudFront includes theX-XSS-Protection
HTTP response header and the header’s value. For more information about theX-XSS-Protection
HTTP response header, see X-XSS-Protection in the MDN Web Docs.
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_cloudfront as cloudfront security_headers_config_property = cloudfront.CfnResponseHeadersPolicy.SecurityHeadersConfigProperty( content_security_policy=cloudfront.CfnResponseHeadersPolicy.ContentSecurityPolicyProperty( content_security_policy="contentSecurityPolicy", override=False ), content_type_options=cloudfront.CfnResponseHeadersPolicy.ContentTypeOptionsProperty( override=False ), frame_options=cloudfront.CfnResponseHeadersPolicy.FrameOptionsProperty( frame_option="frameOption", override=False ), referrer_policy=cloudfront.CfnResponseHeadersPolicy.ReferrerPolicyProperty( override=False, referrer_policy="referrerPolicy" ), strict_transport_security=cloudfront.CfnResponseHeadersPolicy.StrictTransportSecurityProperty( access_control_max_age_sec=123, override=False, # the properties below are optional include_subdomains=False, preload=False ), xss_protection=cloudfront.CfnResponseHeadersPolicy.XSSProtectionProperty( override=False, protection=False, # the properties below are optional mode_block=False, report_uri="reportUri" ) )
Attributes
- content_security_policy
The policy directives and their values that CloudFront includes as values for the
Content-Security-Policy
HTTP response header.For more information about the
Content-Security-Policy
HTTP response header, see Content-Security-Policy in the MDN Web Docs.
- content_type_options
Determines whether CloudFront includes the
X-Content-Type-Options
HTTP response header with its value set tonosniff
.For more information about the
X-Content-Type-Options
HTTP response header, see X-Content-Type-Options in the MDN Web Docs.
- frame_options
Determines whether CloudFront includes the
X-Frame-Options
HTTP response header and the header’s value.For more information about the
X-Frame-Options
HTTP response header, see X-Frame-Options in the MDN Web Docs.
- referrer_policy
Determines whether CloudFront includes the
Referrer-Policy
HTTP response header and the header’s value.For more information about the
Referrer-Policy
HTTP response header, see Referrer-Policy in the MDN Web Docs.
- strict_transport_security
Determines whether CloudFront includes the
Strict-Transport-Security
HTTP response header and the header’s value.For more information about the
Strict-Transport-Security
HTTP response header, see Strict-Transport-Security in the MDN Web Docs.
- xss_protection
Determines whether CloudFront includes the
X-XSS-Protection
HTTP response header and the header’s value.For more information about the
X-XSS-Protection
HTTP response header, see X-XSS-Protection in the MDN Web Docs.
ServerTimingHeadersConfigProperty
- class CfnResponseHeadersPolicy.ServerTimingHeadersConfigProperty(*, enabled, sampling_rate=None)
Bases:
object
A configuration for enabling the
Server-Timing
header in HTTP responses sent from CloudFront.- Parameters:
enabled (
Union
[bool
,IResolvable
]) – A Boolean that determines whether CloudFront adds theServer-Timing
header to HTTP responses that it sends in response to requests that match a cache behavior that’s associated with this response headers policy.sampling_rate (
Union
[int
,float
,None
]) – A number 0–100 (inclusive) that specifies the percentage of responses that you want CloudFront to add theServer-Timing
header to. When you set the sampling rate to 100, CloudFront adds theServer-Timing
header to the HTTP response for every request that matches the cache behavior that this response headers policy is attached to. When you set it to 50, CloudFront adds the header to 50% of the responses for requests that match the cache behavior. You can set the sampling rate to any number 0–100 with up to four decimal places.
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_cloudfront as cloudfront server_timing_headers_config_property = cloudfront.CfnResponseHeadersPolicy.ServerTimingHeadersConfigProperty( enabled=False, # the properties below are optional sampling_rate=123 )
Attributes
- enabled
A Boolean that determines whether CloudFront adds the
Server-Timing
header to HTTP responses that it sends in response to requests that match a cache behavior that’s associated with this response headers policy.
- sampling_rate
A number 0–100 (inclusive) that specifies the percentage of responses that you want CloudFront to add the
Server-Timing
header to.When you set the sampling rate to 100, CloudFront adds the
Server-Timing
header to the HTTP response for every request that matches the cache behavior that this response headers policy is attached to. When you set it to 50, CloudFront adds the header to 50% of the responses for requests that match the cache behavior. You can set the sampling rate to any number 0–100 with up to four decimal places.
StrictTransportSecurityProperty
- class CfnResponseHeadersPolicy.StrictTransportSecurityProperty(*, access_control_max_age_sec, override, include_subdomains=None, preload=None)
Bases:
object
Determines whether CloudFront includes the
Strict-Transport-Security
HTTP response header and the header’s value.For more information about the
Strict-Transport-Security
HTTP response header, see Strict-Transport-Security in the MDN Web Docs.- Parameters:
access_control_max_age_sec (
Union
[int
,float
]) – A number that CloudFront uses as the value for themax-age
directive in theStrict-Transport-Security
HTTP response header.override (
Union
[bool
,IResolvable
]) – A Boolean that determines whether CloudFront overrides theStrict-Transport-Security
HTTP response header received from the origin with the one specified in this response headers policy.include_subdomains (
Union
[bool
,IResolvable
,None
]) – A Boolean that determines whether CloudFront includes theincludeSubDomains
directive in theStrict-Transport-Security
HTTP response header.preload (
Union
[bool
,IResolvable
,None
]) – A Boolean that determines whether CloudFront includes thepreload
directive in theStrict-Transport-Security
HTTP response header.
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_cloudfront as cloudfront strict_transport_security_property = cloudfront.CfnResponseHeadersPolicy.StrictTransportSecurityProperty( access_control_max_age_sec=123, override=False, # the properties below are optional include_subdomains=False, preload=False )
Attributes
- access_control_max_age_sec
A number that CloudFront uses as the value for the
max-age
directive in theStrict-Transport-Security
HTTP response header.
- include_subdomains
A Boolean that determines whether CloudFront includes the
includeSubDomains
directive in theStrict-Transport-Security
HTTP response header.
- override
A Boolean that determines whether CloudFront overrides the
Strict-Transport-Security
HTTP response header received from the origin with the one specified in this response headers policy.
- preload
A Boolean that determines whether CloudFront includes the
preload
directive in theStrict-Transport-Security
HTTP response header.
XSSProtectionProperty
- class CfnResponseHeadersPolicy.XSSProtectionProperty(*, override, protection, mode_block=None, report_uri=None)
Bases:
object
Determines whether CloudFront includes the
X-XSS-Protection
HTTP response header and the header’s value.For more information about the
X-XSS-Protection
HTTP response header, see X-XSS-Protection in the MDN Web Docs.- Parameters:
override (
Union
[bool
,IResolvable
]) – A Boolean that determines whether CloudFront overrides theX-XSS-Protection
HTTP response header received from the origin with the one specified in this response headers policy.protection (
Union
[bool
,IResolvable
]) –A Boolean that determines the value of the
X-XSS-Protection
HTTP response header. When this setting istrue
, the value of theX-XSS-Protection
header is1
. When this setting isfalse
, the value of theX-XSS-Protection
header is0
. For more information about these settings, see X-XSS-Protection in the MDN Web Docs.mode_block (
Union
[bool
,IResolvable
,None
]) –A Boolean that determines whether CloudFront includes the
mode=block
directive in theX-XSS-Protection
header. For more information about this directive, see X-XSS-Protection in the MDN Web Docs.report_uri (
Optional
[str
]) –A reporting URI, which CloudFront uses as the value of the
report
directive in theX-XSS-Protection
header. You cannot specify aReportUri
whenModeBlock
istrue
. For more information about using a reporting URL, see X-XSS-Protection in the MDN Web Docs.
- Link:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. import aws_cdk.aws_cloudfront as cloudfront x_sSProtection_property = cloudfront.CfnResponseHeadersPolicy.XSSProtectionProperty( override=False, protection=False, # the properties below are optional mode_block=False, report_uri="reportUri" )
Attributes
- mode_block
A Boolean that determines whether CloudFront includes the
mode=block
directive in theX-XSS-Protection
header.For more information about this directive, see X-XSS-Protection in the MDN Web Docs.
- override
A Boolean that determines whether CloudFront overrides the
X-XSS-Protection
HTTP response header received from the origin with the one specified in this response headers policy.
- protection
A Boolean that determines the value of the
X-XSS-Protection
HTTP response header.When this setting is
true
, the value of theX-XSS-Protection
header is1
. When this setting isfalse
, the value of theX-XSS-Protection
header is0
.For more information about these settings, see X-XSS-Protection in the MDN Web Docs.
- report_uri
A reporting URI, which CloudFront uses as the value of the
report
directive in theX-XSS-Protection
header.You cannot specify a
ReportUri
whenModeBlock
istrue
.For more information about using a reporting URL, see X-XSS-Protection in the MDN Web Docs.