CustomOriginConfig

class aws_cdk.aws_cloudfront.CustomOriginConfig(*, domain_name, allowed_origin_ssl_versions=None, http_port=None, https_port=None, origin_headers=None, origin_keepalive_timeout=None, origin_path=None, origin_protocol_policy=None, origin_read_timeout=None, origin_shield_region=None)

Bases: object

A custom origin configuration.

Parameters:
  • domain_name (str) – The domain name of the custom origin. Should not include the path - that should be in the parent SourceConfiguration

  • allowed_origin_ssl_versions (Optional[Sequence[OriginSslPolicy]]) – The SSL versions to use when interacting with the origin. Default: OriginSslPolicy.TLS_V1_2

  • http_port (Union[int, float, None]) – The origin HTTP port. Default: 80

  • https_port (Union[int, float, None]) – The origin HTTPS port. Default: 443

  • origin_headers (Optional[Mapping[str, str]]) – Any additional headers to pass to the origin. Default: - No additional headers are passed.

  • origin_keepalive_timeout (Optional[Duration]) – The keep alive timeout when making calls in seconds. Default: Duration.seconds(5)

  • origin_path (Optional[str]) – The relative path to the origin root to use for sources. Default: /

  • origin_protocol_policy (Optional[OriginProtocolPolicy]) – The protocol (http or https) policy to use when interacting with the origin. Default: OriginProtocolPolicy.HttpsOnly

  • origin_read_timeout (Optional[Duration]) – The read timeout when calling the origin in seconds. Default: Duration.seconds(30)

  • origin_shield_region (Optional[str]) – When you enable Origin Shield in the AWS Region that has the lowest latency to your origin, you can get better network performance. Default: - origin shield not enabled

ExampleMetadata:

infused

Example:

# source_bucket: s3.Bucket
# oai: cloudfront.OriginAccessIdentity


cloudfront.CloudFrontWebDistribution(self, "MyCfWebDistribution",
    origin_configs=[cloudfront.SourceConfiguration(
        s3_origin_source=cloudfront.S3OriginConfig(
            s3_bucket_source=source_bucket,
            origin_access_identity=oai
        ),
        behaviors=[cloudfront.Behavior(is_default_behavior=True)]
    ), cloudfront.SourceConfiguration(
        custom_origin_source=cloudfront.CustomOriginConfig(
            domain_name="MYALIAS"
        ),
        behaviors=[cloudfront.Behavior(path_pattern="/somewhere")]
    )
    ]
)

Attributes

allowed_origin_ssl_versions

The SSL versions to use when interacting with the origin.

Default:

OriginSslPolicy.TLS_V1_2

domain_name

The domain name of the custom origin.

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

http_port

The origin HTTP port.

Default:

80

https_port

The origin HTTPS port.

Default:

443

origin_headers

Any additional headers to pass to the origin.

Default:
  • No additional headers are passed.

origin_keepalive_timeout

The keep alive timeout when making calls in seconds.

Default:

Duration.seconds(5)

origin_path

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

Default:

/

origin_protocol_policy

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

Default:

OriginProtocolPolicy.HttpsOnly

origin_read_timeout

The read timeout when calling the origin in seconds.

Default:

Duration.seconds(30)

origin_shield_region

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

Default:
  • origin shield not enabled