Why is my Amazon S3 bucket returning a list of objects instead of the website's index page?

2 minute read
0

I'm using an Amazon Simple Storage Service (Amazon S3) bucket to host my static website. Why is the bucket returning a list of objects instead of the website's index page?

Short description

If you send a GET request to the bucket, then send the request to the website endpoint so that Amazon S3 returns the index page. Otherwise, Amazon S3 returns a list of objects in the bucket if you have permissions to the ListBucket API call.

If you use an Amazon CloudFront distribution with an Amazon S3 origin, then you must also set the index page as the default root object.

Resolution

Follow these steps to find your bucket's website endpoint:

  1. Open the Amazon S3 console.
  2. From the bucket list, choose the bucket that you're using to host the static website.
  3. Choose the Properties view, and then choose Static website hosting. The website endpoint is the value that's listed as Endpoint.

If you're using CloudFront distribution with an Amazon S3 origin, then follow these steps to set your distribution's default root object to the index page:

  1. Open the CloudFront console.
  2. From the distribution list, choose the distribution that's associated with your S3 bucket.
  3. From the General view, choose Edit.
  4. For Default Root Object, enter the object name of your index page. For example, "index.html".
  5. Choose Yes, Edit.

Note: Endpoints vary by AWS region. For website endpoints by region, see Amazon S3 website endpoints. For REST API endpoints by region, see Amazon S3 endpoints.


Related information

Key differences between the Amazon website and the REST API endpoint

AWS OFFICIAL
AWS OFFICIALUpdated 4 months ago