ViewerProtocolPolicy

class aws_cdk.aws_cloudfront.ViewerProtocolPolicy(value)

Bases: Enum

How HTTPs should be handled with your distribution.

ExampleMetadata:

infused

Example:

# Create a Distribution with configured HTTP methods and viewer protocol policy of the cache.
# my_bucket: s3.Bucket

my_web_distribution = cloudfront.Distribution(self, "myDist",
    default_behavior=cloudfront.BehaviorOptions(
        origin=origins.S3Origin(my_bucket),
        allowed_methods=cloudfront.AllowedMethods.ALLOW_ALL,
        viewer_protocol_policy=cloudfront.ViewerProtocolPolicy.REDIRECT_TO_HTTPS
    )
)

Attributes

ALLOW_ALL

Both HTTP and HTTPS supported.

HTTPS_ONLY

HTTPS only.

REDIRECT_TO_HTTPS

Will redirect HTTP requests to HTTPS.