# 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.

- Source: [`aws-cloudfront/lib/origin-request-policy.ts`](https://github.com/aws/aws-cdk/blob/v2.273.0/packages/aws-cdk-lib/aws-cloudfront/lib/origin-request-policy.ts#L250)
- Type last changed: v2.88.0 · 20 Jul 2023

## Example

```ts
// 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

- `behavior`: string (required) — The 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.

## Methods

- `all(): OriginRequestQueryStringBehavior // chainable` (static) — All query strings in viewer requests are included in requests that CloudFront sends to the origin.

- `allowList(...queryStrings: string[]): OriginRequestQueryStringBehavior // chainable` (static) — Only the provided `queryStrings` are included in requests that CloudFront sends to the origin.

- `denyList(...queryStrings: string[]): OriginRequestQueryStringBehavior // chainable` (static) — All query strings except the provided `queryStrings` are included in requests that CloudFront sends to the origin.

- `none(): OriginRequestQueryStringBehavior // chainable` (static) — 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.
