So you’re trying to configure Cloudfront on top of an S3 bucket where you host your static website?
And you’re getting 307 redirecting to the S3 bucket DNS when accessing the DNS you configured in Cloudfront?
laBrute is coming to your rescue … well… you might not like the answer.
But let’s wind back a bit and look at the scenario:
- You created an S3 bucket called:
origin-mysitein the Sydney region, which would have the URL origin-mysite.s3-ap-southeast-2.amazonaws.com
- You then create a Cloudfront distribution with that bucket set as the origin
- You create a DNS name
www.mysite.comthat points to CloudFront and have it set in Cloudfront as Alternate Domain Names
- You try to now access your site via
http://www.mysite.combut get redirected to
That’s because of the distributed nature of S3.
If a request arrives at the wrong Amazon S3 location, Amazon S3 responds with a temporary redirect that tells the requester to resend the request to a new endpoint.
You can read more about it here.
Basically the fix is … to wait for it!
Note that if you were using the
us-east-1 region, you should not hit this specific problem.