I have an S3 bucket. When accessing its root URL via https://s3.amazonaws.com/... it tells me Access denied
.
This S3 bucket doesn't have any permission rules defined for Everyone
.
However, accessing the same bucket via our CloudFront Domain Name
a full ListBucketResult
is being returned.
CloudFront is giving a full directory listing, which we want to prevent.
How can I disable that listing via CloudFront?
I tried invalidating all objects (*
) in CloudFront, without effect.
In the right pane of the CloudFront console, select the check box for the distribution that you want to delete. Choose Disable to disable the distribution, and choose Yes, Disable to confirm.
Configuration on the origin On your custom origin web server application, add Cache-Control no-cache, no-store, or private directives to the objects that you don't want CloudFront to cache. Or, add Expires directives to the objects that you don't want CloudFront to cache.
By default, your Amazon S3 bucket and all the files in it are private—only the Amazon account that created the bucket has permission to read or write the files. If you want to allow anyone to access the files in your Amazon S3 bucket using CloudFront URLs, you must grant public read permissions to the objects.
Did you already get it? If not, you can try setting Default Root object for your cloudfront distribution.
setting Default Root should work. Another option is to just put any index.html file at your root. You could take a blank text file and rename it "index.html", or put some generic HTML message in the file too. Either way, a call to root of your cloudfront distribution will just default to that file instead of listing your directories / files.
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