Note that there are some explanatory texts on larger screens.

plurals
  1. POWhy doesn’t Amazon S3 automatically serve /foo/index.html when I ask for /foo or /foo/?
    text
    copied!<p>I am looking into serving my static site with Amazon S3. I have created a bucket and uploaded my files; under the “Website” tab in the AWS Management Console I have checked “Enabled” and entered <code>index.html</code> in the “Index Document” field. I have the following bucket policy:</p> <pre><code>{ "Version": "2008-10-17", "Id": "924a2348-de0e-43aa-bb06-83adbcd1db22", "Statement": [ { "Sid": "PublicReadForGetBucketObjects", "Effect": "Allow", "Principal": { "AWS": "*" }, "Action": "s3:GetObject", "Resource": "arn:aws:s3:::my-bucket/*" } ] } </code></pre> <p>where I have my bucket’s name instead of <code>my-bucket</code>. Under the “Permissions” tab I have also granted “Everyone” the list ability.</p> <p>If I try to access <code>my-bucket.s3.amazonaws.com/index.html</code> my page (and its images, CSS, etc.) shows up as expected. However, just going to <code>my-bucket.s3.amazonaws.com</code> or <code>my-bucket.s3.amazonaws.com/</code> gives a directory-listing XML file instead of showing the page. If I try to go to <code>my-bucket.s3.amazonaws.com/subdirectory</code> I get an error (in XML) saying “The specified key does not exist.” Most bizarrely, if I try to go to <code>my-bucket.s3.amazonaws.com/subdirectory/</code> (with a trailing slash), no page loads but my browser downloads an empty file named <code>download</code>. (Once again, going to <code>my-bucket.s3.amazonaws.com/subdirectory/index.html</code> shows the page as expected.)</p> <p>Am I doing something wrong here? How do I get S3 to show the <code>index.html</code> file when a directory name is requested?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload