UpdateOriginRequestPolicy - Amazon CloudFront
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

UpdateOriginRequestPolicy

Updates an origin request policy configuration.

When you update an origin request policy configuration, all the fields are updated with the values provided in the request. You cannot update some fields independent of others. To update an origin request policy configuration:

  1. Use GetOriginRequestPolicyConfig to get the current configuration.

  2. Locally modify the fields in the origin request policy configuration that you want to update.

  3. Call UpdateOriginRequestPolicy by providing the entire origin request policy configuration, including the fields that you modified and those that you didn't.

Request Syntax

PUT /2020-05-31/origin-request-policy/Id HTTP/1.1 <?xml version="1.0" encoding="UTF-8"?> <OriginRequestPolicyConfig xmlns="http://cloudfront.amazonaws.com/doc/2020-05-31/"> <Comment>string</Comment> <CookiesConfig> <CookieBehavior>string</CookieBehavior> <Cookies> <Items> <Name>string</Name> </Items> <Quantity>integer</Quantity> </Cookies> </CookiesConfig> <HeadersConfig> <HeaderBehavior>string</HeaderBehavior> <Headers> <Items> <Name>string</Name> </Items> <Quantity>integer</Quantity> </Headers> </HeadersConfig> <Name>string</Name> <QueryStringsConfig> <QueryStringBehavior>string</QueryStringBehavior> <QueryStrings> <Items> <Name>string</Name> </Items> <Quantity>integer</Quantity> </QueryStrings> </QueryStringsConfig> </OriginRequestPolicyConfig>

URI Request Parameters

The request does not use any URI parameters.

Request Body

The request accepts the following data in XML format.

OriginRequestPolicyConfig

Root level tag for the OriginRequestPolicyConfig parameters.

Required: Yes

Comment

A comment to describe the origin request policy. The comment cannot be longer than 128 characters.

Type: String

Required: No

CookiesConfig

The cookies from viewer requests to include in origin requests.

Type: OriginRequestPolicyCookiesConfig object

Required: Yes

HeadersConfig

The HTTP headers to include in origin requests. These can include headers from viewer requests and additional headers added by CloudFront.

Type: OriginRequestPolicyHeadersConfig object

Required: Yes

Name

A unique name to identify the origin request policy.

Type: String

Required: Yes

QueryStringsConfig

The URL query strings from viewer requests to include in origin requests.

Type: OriginRequestPolicyQueryStringsConfig object

Required: Yes

Response Syntax

HTTP/1.1 200 <?xml version="1.0" encoding="UTF-8"?> <OriginRequestPolicy> <Id>string</Id> <LastModifiedTime>timestamp</LastModifiedTime> <OriginRequestPolicyConfig> <Comment>string</Comment> <CookiesConfig> <CookieBehavior>string</CookieBehavior> <Cookies> <Items> <Name>string</Name> </Items> <Quantity>integer</Quantity> </Cookies> </CookiesConfig> <HeadersConfig> <HeaderBehavior>string</HeaderBehavior> <Headers> <Items> <Name>string</Name> </Items> <Quantity>integer</Quantity> </Headers> </HeadersConfig> <Name>string</Name> <QueryStringsConfig> <QueryStringBehavior>string</QueryStringBehavior> <QueryStrings> <Items> <Name>string</Name> </Items> <Quantity>integer</Quantity> </QueryStrings> </QueryStringsConfig> </OriginRequestPolicyConfig> </OriginRequestPolicy>

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in XML format by the service.

OriginRequestPolicy

Root level tag for the OriginRequestPolicy parameters.

Required: Yes

Id

The unique identifier for the origin request policy.

Type: String

LastModifiedTime

The date and time when the origin request policy was last modified.

Type: Timestamp

OriginRequestPolicyConfig

The origin request policy configuration.

Type: OriginRequestPolicyConfig object

Errors

For information about the errors that are common to all actions, see Common Errors.

AccessDenied

Access denied.

HTTP Status Code: 403

IllegalUpdate

The update contains modifications that are not allowed.

HTTP Status Code: 400

InconsistentQuantities

The value of Quantity and the size of Items don't match.

HTTP Status Code: 400

InvalidArgument

An argument is invalid.

HTTP Status Code: 400

InvalidIfMatchVersion

The If-Match version is missing or not valid.

HTTP Status Code: 400

NoSuchOriginRequestPolicy

The origin request policy does not exist.

HTTP Status Code: 404

OriginRequestPolicyAlreadyExists

An origin request policy with this name already exists. You must provide a unique name. To modify an existing origin request policy, use UpdateOriginRequestPolicy.

HTTP Status Code: 409

PreconditionFailed

The precondition in one or more of the request fields evaluated to false.

HTTP Status Code: 412

TooManyCookiesInOriginRequestPolicy

The number of cookies in the origin request policy exceeds the maximum. For more information, see Quotas (formerly known as limits) in the Amazon CloudFront Developer Guide.

HTTP Status Code: 400

TooManyHeadersInOriginRequestPolicy

The number of headers in the origin request policy exceeds the maximum. For more information, see Quotas (formerly known as limits) in the Amazon CloudFront Developer Guide.

HTTP Status Code: 400

TooManyQueryStringsInOriginRequestPolicy

The number of query strings in the origin request policy exceeds the maximum. For more information, see Quotas (formerly known as limits) in the Amazon CloudFront Developer Guide.

HTTP Status Code: 400

See Also

For more information about using this API in one of the language-specific Amazon SDKs, see the following: