Skip to content
v2.275.0

ViewerProtocolPolicy Enum ​

How HTTPs should be handled with your distribution.

Example ​

ts
// Create a Distribution with configured HTTP methods and viewer protocol policy of the cache.
declare const myBucket: s3.Bucket;
const myWebDistribution = new cloudfront.Distribution(this, 'myDist', {
  defaultBehavior: {
    origin: new origins.S3Origin(myBucket),
    allowedMethods: cloudfront.AllowedMethods.ALLOW_ALL,
    viewerProtocolPolicy: cloudfront.ViewerProtocolPolicy.REDIRECT_TO_HTTPS,
  },
});

Members ​

MemberDescription
HTTPS_ONLYHTTPS only.
REDIRECT_TO_HTTPSWill redirect HTTP requests to HTTPS.
ALLOW_ALLBoth HTTP and HTTPS supported.

Referenced by ​

  • AddBehaviorOptions.viewerProtocolPolicyviewer_protocol_policyviewerProtocolPolicyViewerProtocolPolicyViewerProtocolPolicy
  • Behavior.viewerProtocolPolicyviewer_protocol_policyviewerProtocolPolicyViewerProtocolPolicyViewerProtocolPolicy
  • CloudFrontWebDistributionProps.viewerProtocolPolicyviewer_protocol_policyviewerProtocolPolicyViewerProtocolPolicyViewerProtocolPolicy