I'm struggling with my S3 and CloudFront configuration and have tried looking for solutions all over. Here's my setup: I have two S3 buckets, one for my main site (example.com) and one for the www version (www.example.com), which redirects to the origin bucket. I also set up two CloudFront distributions—one for each bucket, with respective TLS certificates. However, when I go to www.example.com, it seems like it redirects to a CloudFront URL instead of the proper custom domain, adding some weird stuff to the URL. Could someone help me figure out what I'm missing?
1 Answer
You really don't need two buckets for this setup. It's actually simpler to have just one bucket for the www version. Then, on your DNS provider, you can set up a redirect from your root domain to the www. That way, everything gets rerouted smoothly, and CloudFront will handle the HTTPS for you!
Thanks! I had a feeling the two buckets were a bit overkill. This much simpler method sounds way better!