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.
This is an asynchronous operation using the standard naming convention for .NET 4.5 or higher. For .NET 3.5 the operation is implemented as a pair of methods using the standard naming convention of BeginCreateResponseHeadersPolicy and EndCreateResponseHeadersPolicy.
Namespace: Amazon.CloudFront
Assembly: AWSSDK.CloudFront.dll
Version: 3.x.y.z
public abstract Task<CreateResponseHeadersPolicyResponse> CreateResponseHeadersPolicyAsync( CreateResponseHeadersPolicyRequest request, CancellationToken cancellationToken )
Container for the necessary parameters to execute the CreateResponseHeadersPolicy service method.
A cancellation token that can be used by other objects or threads to receive notice of cancellation.
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 Core App:
Supported in: 3.1
.NET Standard:
Supported in: 2.0
.NET Framework:
Supported in: 4.5