Skip to content
v2.278.0

OriginRequestPolicyConfigProperty Struct ​

An origin request policy configuration.

This configuration 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 an 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 .

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_cloudfront as cloudfront } from 'aws-cdk-lib';
const originRequestPolicyConfigProperty: cloudfront.CfnOriginRequestPolicy.OriginRequestPolicyConfigProperty = {
  cookiesConfig: {
    cookieBehavior: 'cookieBehavior',

    // the properties below are optional
    cookies: ['cookies'],
  },
  headersConfig: {
    headerBehavior: 'headerBehavior',

    // the properties below are optional
    headers: ['headers'],
  },
  name: 'name',
  queryStringsConfig: {
    queryStringBehavior: 'queryStringBehavior',

    // the properties below are optional
    queryStrings: ['queryStrings'],
  },

  // the properties below are optional
  comment: 'comment',
};
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_cloudfront as cloudfront

origin_request_policy_config_property = cloudfront.CfnOriginRequestPolicy.OriginRequestPolicyConfigProperty(
    cookies_config=cloudfront.CfnOriginRequestPolicy.CookiesConfigProperty(
        cookie_behavior="cookieBehavior",

        # the properties below are optional
        cookies=["cookies"]
    ),
    headers_config=cloudfront.CfnOriginRequestPolicy.HeadersConfigProperty(
        header_behavior="headerBehavior",

        # the properties below are optional
        headers=["headers"]
    ),
    name="name",
    query_strings_config=cloudfront.CfnOriginRequestPolicy.QueryStringsConfigProperty(
        query_string_behavior="queryStringBehavior",

        # the properties below are optional
        query_strings=["queryStrings"]
    ),

    # the properties below are optional
    comment="comment"
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.cloudfront.*;

OriginRequestPolicyConfigProperty originRequestPolicyConfigProperty = OriginRequestPolicyConfigProperty.builder()
        .cookiesConfig(CookiesConfigProperty.builder()
                .cookieBehavior("cookieBehavior")

                // the properties below are optional
                .cookies(List.of("cookies"))
                .build())
        .headersConfig(HeadersConfigProperty.builder()
                .headerBehavior("headerBehavior")

                // the properties below are optional
                .headers(List.of("headers"))
                .build())
        .name("name")
        .queryStringsConfig(QueryStringsConfigProperty.builder()
                .queryStringBehavior("queryStringBehavior")

                // the properties below are optional
                .queryStrings(List.of("queryStrings"))
                .build())

        // the properties below are optional
        .comment("comment")
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.CloudFront;

var originRequestPolicyConfigProperty = new OriginRequestPolicyConfigProperty {
    CookiesConfig = new CookiesConfigProperty {
        CookieBehavior = "cookieBehavior",

        // the properties below are optional
        Cookies = new [] { "cookies" }
    },
    HeadersConfig = new HeadersConfigProperty {
        HeaderBehavior = "headerBehavior",

        // the properties below are optional
        Headers = new [] { "headers" }
    },
    Name = "name",
    QueryStringsConfig = new QueryStringsConfigProperty {
        QueryStringBehavior = "queryStringBehavior",

        // the properties below are optional
        QueryStrings = new [] { "queryStrings" }
    },

    // the properties below are optional
    Comment = "comment"
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

originRequestPolicyConfigProperty := &OriginRequestPolicyConfigProperty{
	CookiesConfig: &CookiesConfigProperty{
		CookieBehavior: jsii.String("cookieBehavior"),

		// the properties below are optional
		Cookies: []*string{
			jsii.String("cookies"),
		},
	},
	HeadersConfig: &HeadersConfigProperty{
		HeaderBehavior: jsii.String("headerBehavior"),

		// the properties below are optional
		Headers: []*string{
			jsii.String("headers"),
		},
	},
	Name: jsii.String("name"),
	QueryStringsConfig: &QueryStringsConfigProperty{
		QueryStringBehavior: jsii.String("queryStringBehavior"),

		// the properties below are optional
		QueryStrings: []*string{
			jsii.String("queryStrings"),
		},
	},

	// the properties below are optional
	Comment: jsii.String("comment"),
}

Properties ​

commentoptionalstringcommentoptionalstrcommentoptionalStringCommentoptionalstringCommentoptional*string #
A comment to describe the origin request policy.

The comment cannot be longer than 128 characters.

cookiesConfigIResolvable | CfnOriginRequestPolicy.CookiesConfigPropertycookies_configtyping.Union[IResolvable, CookiesConfigProperty]cookiesConfigIResolvableCookiesConfigIResolvableCookiesConfiginterface{} required #
The cookies from viewer requests to include in origin requests.
headersConfigIResolvable | CfnOriginRequestPolicy.HeadersConfigPropertyheaders_configtyping.Union[IResolvable, HeadersConfigProperty]headersConfigIResolvableHeadersConfigIResolvableHeadersConfiginterface{} required #
The HTTP headers to include in origin requests.

These can include headers from viewer requests and additional headers added by CloudFront.

namestringnamestrnameStringNamestringName*string required #
A unique name to identify the origin request policy.
queryStringsConfigIResolvable | CfnOriginRequestPolicy.QueryStringsConfigPropertyquery_strings_configtyping.Union[IResolvable, QueryStringsConfigProperty]queryStringsConfigIResolvableQueryStringsConfigIResolvableQueryStringsConfiginterface{} required #
The URL query strings from viewer requests to include in origin requests.