Setting index document on S3 website with custom domain

后端 未结 1 777
我在风中等你
我在风中等你 2020-12-21 07:45

I\'m trying to set an index document for my S3 hosted website. I\'ve

  1. Enabled website hosting on the bucket
  2. Set the index document to \"index.html\"
1条回答
  •  粉色の甜心
    2020-12-21 08:08

    Your DNS isn't configured correctly.

    You are pointing to one of the REST endpoints (CNAME s3.amazonaws.com), which doesn't support index documents. You need the DNS to point to the web site hosting endpoint, in this case it's CNAME static.appgrinders.com.s3-website.us-east-1.amazonaws.com. This endpoint is visible in the S3 console.

    This change will fix your issue.

    http://docs.aws.amazon.com/AmazonS3/latest/dev/WebsiteEndpoints.html

    The giveaway of the nature of the misconfiguration (before I confirmed in DNS) was the XML error. The web site hosting endpoints don't return XML errors -- they return the same information, but it's wrapped in some simple HTML, instead of XML.

    Note, however, that you will still need to use CloudFront if you want your site to be accessible with SSL. Custom domains in S3 require CloudFront's help for SSL support. The web site hosting endpoints, unlike the REST endpoints, don't listen on port 443 at all.

    In the CloudFront configuration, you'll need to avoid the same error -- don't select the bucket name from the dropdown list, since this will send requests to the REST endpoint. You'll need to supply the web site endpoint hostname as the origin.

    0 讨论(0)
提交回复
热议问题