aws-cdk-lib.aws_cloudfront.CustomOriginConfig

interface CustomOriginConfig

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

A custom origin configuration.

Example

declare const sourceBucket: s3.Bucket;
declare const oai: cloudfront.OriginAccessIdentity;

new cloudfront.CloudFrontWebDistribution(this, 'MyCfWebDistribution', {
  originConfigs: [
    {
      s3OriginSource: {
        s3BucketSource: sourceBucket,
        originAccessIdentity: oai,
      },
      behaviors: [ {isDefaultBehavior: true}],
    },
    {
      customOriginSource: {
        domainName: 'MYALIAS',
      },
      behaviors: [{ pathPattern: '/somewhere' }]
    }
  ],
});

Properties

NameTypeDescription
domainNamestringThe domain name of the custom origin.
allowedOriginSSLVersions?OriginSslPolicy[]The SSL versions to use when interacting with the origin.
httpPort?numberThe origin HTTP port.
httpsPort?numberThe origin HTTPS port.
originHeaders?{ [string]: string }Any additional headers to pass to the origin.
originKeepaliveTimeout?DurationThe keep alive timeout when making calls in seconds.
originPath?stringThe relative path to the origin root to use for sources.
originProtocolPolicy?OriginProtocolPolicyThe protocol (http or https) policy to use when interacting with the origin.
originReadTimeout?DurationThe read timeout when calling the origin in seconds.
originShieldRegion?stringWhen you enable Origin Shield in the AWS Region that has the lowest latency to your origin, you can get better network performance.

domainName

Type: string

The domain name of the custom origin.

Should not include the path - that should be in the parent SourceConfiguration


allowedOriginSSLVersions?

Type: OriginSslPolicy[] (optional, default: OriginSslPolicy.TLS_V1_2)

The SSL versions to use when interacting with the origin.


httpPort?

Type: number (optional, default: 80)

The origin HTTP port.


httpsPort?

Type: number (optional, default: 443)

The origin HTTPS port.


originHeaders?

Type: { [string]: string } (optional, default: No additional headers are passed.)

Any additional headers to pass to the origin.


originKeepaliveTimeout?

Type: Duration (optional, default: Duration.seconds(5))

The keep alive timeout when making calls in seconds.


originPath?

Type: string (optional, default: /)

The relative path to the origin root to use for sources.


originProtocolPolicy?

Type: OriginProtocolPolicy (optional, default: OriginProtocolPolicy.HttpsOnly)

The protocol (http or https) policy to use when interacting with the origin.


originReadTimeout?

Type: Duration (optional, default: Duration.seconds(30))

The read timeout when calling the origin in seconds.


originShieldRegion?

Type: string (optional, default: origin shield not enabled)

When you enable Origin Shield in the AWS Region that has the lowest latency to your origin, you can get better network performance.