How to redirect HTTP to HTTPS using S3, Cloudfront and Route 53 using bare domains?

I have a domain (example.com) with SSL support. I had a problem trying to redirect a request from www.example.comhttps://example.com.

Error trying to access www.example.com:

The request could not be satisfied.

Bad request.

These URLs work (redirected to https://example.com)

  • example.com
  • http://example.com
  • https://example.com

http://www.example.com indicates that the website is not secure, that is, it does not use a certificate.


S3

I created 2 S3 buckets example.com and www.example.com (respectively A and B). Bucket Static website hosting allows you to host a website by pointing to example.com. Bucket B Static website hosting redirects all requests to example.com.


Cloudfront

(CNAME), example.com www.example.com. SSL dist.


53

A, example.com www.example.com, Cloudfront (XX.cloudfront.net)

+20
2

, Cloudfront. , S3 Cloudfront, . , , : CloudFront Amazon S3

, , https, : CloudFront> > > "". http https.

enter image description here

+45
+5

Source: https://habr.com/ru/post/1667090/


All Articles