# OriginRequestHeaderBehavior

Determines whether any HTTP headers (and if so, which headers) 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.275.0/packages/aws-cdk-lib/aws-cloudfront/lib/origin-request-policy.ts#L193)
- 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 — The behavior of headers: allow all, none or an allow list.

- `headers`: string[] — The headers for the allow list or the included CloudFront headers, if applicable.

## Methods

- `all(...cloudfrontHeaders: string[]): OriginRequestHeaderBehavior // chainable` (static) — All HTTP headers in viewer requests are included in requests that CloudFront sends to the origin.

  Additionally, any additional CloudFront headers provided are included; the additional headers are added by CloudFront.

- `allowList(...headers: string[]): OriginRequestHeaderBehavior // chainable` (static) — Listed headers are included in requests that CloudFront sends to the origin.

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

- `none(): OriginRequestHeaderBehavior // chainable` (static) — HTTP headers are not included in requests that CloudFront sends to the origin.

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