create_response_headers_policy
¶
create_response_headers_policy(
response_headers_policy_config: ResponseHeadersPolicyConfig,
*,
config_overrides: Optional[CloudFrontClientConfig] = None,
) -> CreateResponseHeadersPolicyResult
Creates a response headers policy.
A response headers policy contains information about a set of HTTP headers. To create a response headers policy, you provide some metadata about the policy and a set of configurations that specify the 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.
Parameters:
-
response_headers_policy_config(ResponseHeadersPolicyConfig) –Contains metadata about the response headers policy, and a set of configurations that specify the HTTP headers.
Raises:
-
AccessDenied–Access denied.
-
InconsistentQuantities–The value of
Quantityand the size ofItemsdon't match. -
InvalidArgument–An argument is invalid.
-
ResponseHeadersPolicyAlreadyExists–A response headers policy with this name already exists. You must provide a unique name. To modify an existing response headers policy, use
UpdateResponseHeadersPolicy. -
TooLongCSPInResponseHeadersPolicy–The length of the
Content-Security-Policyheader value in the response headers policy exceeds the maximum.For more information, see Quotas (formerly known as limits) in the Amazon CloudFront Developer Guide.
-
TooManyCustomHeadersInResponseHeadersPolicy–The number of custom headers in the response headers policy exceeds the maximum.
For more information, see Quotas (formerly known as limits) in the Amazon CloudFront Developer Guide.
-
TooManyRemoveHeadersInResponseHeadersPolicy–The number of headers in
RemoveHeadersConfigin the response headers policy exceeds the maximum.For more information, see Quotas (formerly known as limits) in the Amazon CloudFront Developer Guide.
-
TooManyResponseHeadersPolicies–You have reached the maximum number of response headers policies for this Amazon Web Services account.
For more information, see Quotas (formerly known as limits) in the Amazon CloudFront Developer Guide.
-
UnknownServiceError–The service returned an error code this client does not model.