aws-cdk-lib.aws_cloudfront.OriginRequestQueryStringBehavior

class OriginRequestQueryStringBehavior

LanguageType name
.NETAmazon.CDK.AWS.CloudFront.OriginRequestQueryStringBehavior
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awscloudfront#OriginRequestQueryStringBehavior
Javasoftware.amazon.awscdk.services.cloudfront.OriginRequestQueryStringBehavior
Pythonaws_cdk.aws_cloudfront.OriginRequestQueryStringBehavior
TypeScript (source)aws-cdk-lib » aws_cloudfront » OriginRequestQueryStringBehavior

Determines whether any URL query strings in viewer requests (and if so, which query strings) are included in requests that CloudFront sends to the origin.

Example

// Creating a custom origin request policy for a Distribution -- all parameters optional
declare const bucketOrigin: origins.S3Origin;
const myOriginRequestPolicy = new cloudfront.OriginRequestPolicy(this, 'OriginRequestPolicy', {
  originRequestPolicyName: 'MyPolicy',
  comment: 'A default policy',
  cookieBehavior: cloudfront.OriginRequestCookieBehavior.none(),
  headerBehavior: cloudfront.OriginRequestHeaderBehavior.all('CloudFront-Is-Android-Viewer'),
  queryStringBehavior: cloudfront.OriginRequestQueryStringBehavior.allowList('username'),
});

new cloudfront.Distribution(this, 'myDistCustomPolicy', {
  defaultBehavior: {
    origin: bucketOrigin,
    originRequestPolicy: myOriginRequestPolicy,
  },
});

Properties

NameTypeDescription
behaviorstringThe behavior of query strings -- allow all, none, or only an allow list.
queryStrings?string[]The query strings to allow, if the behavior is an allow list.

behavior

Type: string

The behavior of query strings -- allow all, none, or only an allow list.


queryStrings?

Type: string[] (optional)

The query strings to allow, if the behavior is an allow list.

Methods

NameDescription
static all()All query strings in viewer requests are included in requests that CloudFront sends to the origin.
static allowList(...queryStrings)Only the provided queryStrings are included in requests that CloudFront sends to the origin.
static none()Query strings in viewer requests are not included in requests that CloudFront sends to the origin.

static all()

public static all(): OriginRequestQueryStringBehavior

Returns

  • OriginRequestQueryStringBehavior

All query strings in viewer requests are included in requests that CloudFront sends to the origin.


static allowList(...queryStrings)

public static allowList(...queryStrings: string[]): OriginRequestQueryStringBehavior

Parameters

  • queryStrings string

Returns

  • OriginRequestQueryStringBehavior

Only the provided queryStrings are included in requests that CloudFront sends to the origin.


static none()

public static none(): OriginRequestQueryStringBehavior

Returns

  • OriginRequestQueryStringBehavior

Query strings in viewer requests are not included in requests that CloudFront sends to the origin.

Any query strings that are listed in a CachePolicy are still included in origin requests.