AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.
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.
For .NET Core this operation is only available in asynchronous form. Please refer to CreateResponseHeadersPolicyAsync.
Namespace: Amazon.CloudFront
Assembly: AWSSDK.CloudFront.dll
Version: 3.x.y.z
public abstract CreateResponseHeadersPolicyResponse CreateResponseHeadersPolicy( CreateResponseHeadersPolicyRequest request )
Container for the necessary parameters to execute the CreateResponseHeadersPolicy service method.
Exception | Condition |
---|---|
AccessDeniedException | Access denied. |
InconsistentQuantitiesException | The value of Quantity and the size of Items don't match. |
InvalidArgumentException | An argument is invalid. |
ResponseHeadersPolicyAlreadyExistsException | A response headers policy with this name already exists. You must provide a unique name. To modify an existing response headers policy, use UpdateResponseHeadersPolicy. |
TooLongCSPInResponseHeadersPolicyException | The length of the Content-Security-Policy header value in the response headers policy exceeds the maximum. For more information, see Quotas (formerly known as limits) in the Amazon CloudFront Developer Guide. |
TooManyCustomHeadersInResponseHeadersPolicyException | 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. |
TooManyRemoveHeadersInResponseHeadersPolicyException | The number of headers in RemoveHeadersConfig in the response headers policy exceeds the maximum. For more information, see Quotas (formerly known as limits) in the Amazon CloudFront Developer Guide. |
TooManyResponseHeadersPoliciesException | 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. |
.NET Framework:
Supported in: 4.5, 4.0, 3.5