I am hosting a static site on aws via s3/coludfront. Anyway I can force cloudfront to redirect all http request to https version.
If you're using CloudFormation:
Resources:
Distribution:
Type: AWS::CloudFront::Distribution
Properties:
...
DistributionConfig:
DefaultCacheBehavior:
ViewerProtocolPolicy: redirect-to-https
...
Previous answer said to use https-only but that will return a 403 (Forbidden) if the viewer sends an HTTP request.
https://docs.aws.amazon.com/cloudfront/latest/APIReference/API_CacheBehavior.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With