Skip to content

CloudFront  >  Operations  >  create_response_headers_policy

create_response_headers_policy

Operation

create_response_headers_policy async

create_response_headers_policy(input: CreateResponseHeadersPolicyInput, plugins: list[Plugin] | None = None) -> CreateResponseHeadersPolicyOutput

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:

Name Type Description Default
input CreateResponseHeadersPolicyInput

An instance of CreateResponseHeadersPolicyInput.

required
plugins list[Plugin] | None

A list of callables that modify the configuration dynamically. Changes made by these plugins only apply for the duration of the operation execution and will not affect any other operation invocations.

None

Returns:

Type Description
CreateResponseHeadersPolicyOutput

An instance of CreateResponseHeadersPolicyOutput.

Input

CreateResponseHeadersPolicyInput dataclass

Bases: _SerdeShape

Dataclass for CreateResponseHeadersPolicyInput structure.

Attributes

response_headers_policy_config class-attribute instance-attribute
response_headers_policy_config: ResponseHeadersPolicyConfig | None = ...

Contains metadata about the response headers policy, and a set of configurations that specify the HTTP headers.

Output

CreateResponseHeadersPolicyOutput dataclass

Bases: _SerdeShape

Dataclass for CreateResponseHeadersPolicyOutput structure.

Attributes

e_tag class-attribute instance-attribute
e_tag: str | None = ...

The version identifier for the current version of the response headers policy.

location class-attribute instance-attribute
location: str | None = ...

The URL of the response headers policy.

response_headers_policy class-attribute instance-attribute
response_headers_policy: ResponseHeadersPolicy | None = ...

Contains a response headers policy.

response_metadata class-attribute instance-attribute
response_metadata: ResponseMetadata = ...

Metadata about the response that produced this output. Use this to recover the request identifiers a service's support team needs in order to investigate a call. Members of the metadata are individually optional.