Skip to content

CloudFront  >  Operations  >  create_origin_request_policy

create_origin_request_policy

Operation

create_origin_request_policy async

create_origin_request_policy(input: CreateOriginRequestPolicyInput, plugins: list[Plugin] | None = None) -> CreateOriginRequestPolicyOutput

Creates an origin request policy.

After you create an origin request policy, you can attach it to one or more cache behaviors. When it's attached to a cache behavior, the origin request policy determines the values that CloudFront includes in requests that it sends to the origin. Each request that CloudFront sends to the origin includes the following:

  • The request body and the URL path (without the domain name) from the viewer request.

  • The headers that CloudFront automatically includes in every origin request, including Host, User-Agent, and X-Amz-Cf-Id.

  • All HTTP headers, cookies, and URL query strings that are specified in the cache policy or the origin request policy. These can include items from the viewer request and, in the case of headers, additional ones that are added by CloudFront.

CloudFront sends a request when it can't find a valid object in its cache that matches the request. If you want to send values to the origin and also include them in the cache key, use CachePolicy.

For more information about origin request policies, see Controlling origin requests in the Amazon CloudFront Developer Guide.

Parameters:

Name Type Description Default
input CreateOriginRequestPolicyInput

An instance of CreateOriginRequestPolicyInput.

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
CreateOriginRequestPolicyOutput

An instance of CreateOriginRequestPolicyOutput.

Input

CreateOriginRequestPolicyInput dataclass

Bases: _SerdeShape

Dataclass for CreateOriginRequestPolicyInput structure.

Attributes

origin_request_policy_config class-attribute instance-attribute
origin_request_policy_config: OriginRequestPolicyConfig | None = ...

An origin request policy configuration.

Output

CreateOriginRequestPolicyOutput dataclass

Bases: _SerdeShape

Dataclass for CreateOriginRequestPolicyOutput structure.

Attributes

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

The current version of the origin request policy.

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

The fully qualified URI of the origin request policy just created.

origin_request_policy class-attribute instance-attribute
origin_request_policy: OriginRequestPolicy | None = ...

An origin request 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.