# CloudFrontWebDistributionProps

Extends: CloudFrontWebDistributionProps
Used as props by: CloudFrontWebDistribution

- Source: [`aws-cloudfront/lib/web-distribution.ts`](https://github.com/aws/aws-cdk/blob/v2.274.0/packages/aws-cdk-lib/aws-cloudfront/lib/web-distribution.ts#L588)

## Example

```ts
declare const sourceBucket: s3.Bucket;
const viewerCertificate = cloudfront.ViewerCertificate.fromIamCertificate('MYIAMROLEIDENTIFIER', {
  aliases: ['MYALIAS'],
});

new cloudfront.CloudFrontWebDistribution(this, 'MyCfWebDistribution', {
  originConfigs: [
    {
      s3OriginSource: {
        s3BucketSource: sourceBucket,
      },
      behaviors : [ {isDefaultBehavior: true} ],
    },
  ],
  viewerCertificate: viewerCertificate,
});
```

## Properties

- `comment`: string — A comment for this distribution in the CloudFront console.

  **Default:** No comment is added to distribution.

- `defaultRootObject`: string — The default object to serve.

  **Default:** "index.html" is served.

- `enabled`: boolean = true — Enable or disable the distribution.

- `enableIpV6`: boolean = true — If your distribution should have IPv6 enabled.

- `errorConfigurations`: [CfnDistribution.CustomErrorResponseProperty](/cdk/api/v2/docs/aws-cdk-lib.aws_cloudfront.CfnDistribution.CustomErrorResponseProperty.html)[] — How CloudFront should handle requests that are not successful (eg PageNotFound).

  **Default:** No custom error configuration.

  By default, CloudFront does not replace HTTP status codes in the 4xx and 5xx range
  with custom error messages. CloudFront does not cache HTTP status codes.

- `geoRestriction`: [GeoRestriction](/cdk/api/v2/docs/aws-cdk-lib.aws_cloudfront.GeoRestriction.html) — Controls the countries in which your content is distributed.

  **Default:** No geo restriction

- `httpVersion`: [HttpVersion](/cdk/api/v2/docs/aws-cdk-lib.aws_cloudfront.HttpVersion.html) = HttpVersion.HTTP2 — The HTTP version(s) to enable for viewers communicating with CloudFront.

- `loggingConfig`: [LoggingConfiguration](/cdk/api/v2/docs/aws-cdk-lib.aws_cloudfront.LoggingConfiguration.html) — Optional - if we should enable logging.

  **Default:** no logging is enabled by default.

  You can pass an empty object ({}) to have us auto create a bucket for logging.
  Omission of this property indicates no logging is to be enabled.

- `originConfigs`: [SourceConfiguration](/cdk/api/v2/docs/aws-cdk-lib.aws_cloudfront.SourceConfiguration.html)[] (required) — The origin configurations for this distribution.

  Behaviors are a part of the origin.

- `priceClass`: [PriceClass](/cdk/api/v2/docs/aws-cdk-lib.aws_cloudfront.PriceClass.html) — The price class for the distribution (this impacts how many locations CloudFront uses for your distribution, and billing).

  **Default:** PriceClass.PRICE_CLASS_100 the cheapest option for CloudFront is picked by default.

- `viewerCertificate`: [ViewerCertificate](/cdk/api/v2/docs/aws-cdk-lib.aws_cloudfront.ViewerCertificate.html) — Specifies whether you want viewers to use HTTP or HTTPS to request your objects, whether you're using an alternate domain name with HTTPS, and if so, if you're using AWS Certificate Manager (ACM) or a third-party certificate authority.

  **Default:** ViewerCertificate.fromCloudFrontDefaultCertificate()

- `viewerProtocolPolicy`: [ViewerProtocolPolicy](/cdk/api/v2/docs/aws-cdk-lib.aws_cloudfront.ViewerProtocolPolicy.html) = RedirectToHTTPs — The default viewer policy for incoming clients.

- `webACLId`: string — Unique identifier that specifies the AWS WAF web ACL to associate with this CloudFront distribution.

  **Default:** No AWS Web Application Firewall web access control list (web ACL).

  To specify a web ACL created using the latest version of AWS WAF, use the ACL ARN, for example
  `arn:aws:wafv2:us-east-1:123456789012:global/webacl/ExampleWebACL/473e64fd-f30b-4765-81a0-62ad96dd167a`.

  To specify a web ACL created using AWS WAF Classic, use the ACL ID, for example `473e64fd-f30b-4765-81a0-62ad96dd167a`.
