带重定向的 S3 存储桶的 HTTPS
HTTPS for S3 bucket with redirection
我在 example.com 上有一个网站。我创建了一个 S3 存储桶并将其设置为将所有请求重定向到 example.com 并且我创建了一个指向 www.[=36= 的 DNS 条目] 到那个 S3 桶。到目前为止,从 http://www.example.com --> http://example.com 重定向工作正常
我无法从 https://www.example.com --> https://example.com.
重定向 https 流量
我已经创建了一个 Cloudfront 分发并向其添加了 SSL,并将其指向上面提到的 S3 存储桶。当我尝试访问给定域名的分配时,我没有被重定向,而是在浏览器中得到以下信息:
<ListBucketResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Name>www.example.com</Name>
<Prefix/>
<Marker/>
<MaxKeys>1000</MaxKeys>
<IsTruncated>false</IsTruncated>
</ListBucketResult>
我的发行版常规设置是
Distribution ID XXXXXXXXXXXX
Log Prefix -
Delivery Method Web
Cookie Logging Off
Distribution Status Deployed
Comment -
Price Class Use All Edge Locations (Best Performance)
AWS WAF Web ACL -
State Enabled
Alternate Domain Names (CNAMEs) -
SSL Certificate mycert
Domain Name xxxxxxxxxxx.cloudfront.net
Custom SSL Client Support Only Clients that Support Server Name Indication (SNI)
Default Root Object -
Last Modified 2016-01-18 16:12 UTC+2
Log Bucket
知道如何让它发挥作用吗?
你很接近。 CloudFront 是正确的解决方案。
您需要一种稍微不同的方法,而不是从 drop-down 中选择存储桶。
在重定向存储桶的 static web site hosting configuration 中,找到 端点 。这将采用类似于 bucket-name.s3-website.${aws_region}.amazonaws.com
.
的形式
使用此主机名,而不是从 drop-down 列表中选择存储桶。
When you specify the bucket name in this format, you can use Amazon S3 redirects and Amazon S3 custom error documents.
http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/DownloadDistS3AndCustomOrigins.html
另请注意,您的 Origin Protocol Policy 指定了 CloudFront 和 S3 之间使用的协议,必须设置为仅 HTTP。 (此设置仅back-end,front-end仍然可以是https)。
我在 example.com 上有一个网站。我创建了一个 S3 存储桶并将其设置为将所有请求重定向到 example.com 并且我创建了一个指向 www.[=36= 的 DNS 条目] 到那个 S3 桶。到目前为止,从 http://www.example.com --> http://example.com 重定向工作正常
我无法从 https://www.example.com --> https://example.com.
重定向 https 流量我已经创建了一个 Cloudfront 分发并向其添加了 SSL,并将其指向上面提到的 S3 存储桶。当我尝试访问给定域名的分配时,我没有被重定向,而是在浏览器中得到以下信息:
<ListBucketResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
<Name>www.example.com</Name>
<Prefix/>
<Marker/>
<MaxKeys>1000</MaxKeys>
<IsTruncated>false</IsTruncated>
</ListBucketResult>
我的发行版常规设置是
Distribution ID XXXXXXXXXXXX
Log Prefix -
Delivery Method Web
Cookie Logging Off
Distribution Status Deployed
Comment -
Price Class Use All Edge Locations (Best Performance)
AWS WAF Web ACL -
State Enabled
Alternate Domain Names (CNAMEs) -
SSL Certificate mycert
Domain Name xxxxxxxxxxx.cloudfront.net
Custom SSL Client Support Only Clients that Support Server Name Indication (SNI)
Default Root Object -
Last Modified 2016-01-18 16:12 UTC+2
Log Bucket
知道如何让它发挥作用吗?
你很接近。 CloudFront 是正确的解决方案。
您需要一种稍微不同的方法,而不是从 drop-down 中选择存储桶。
在重定向存储桶的 static web site hosting configuration 中,找到 端点 。这将采用类似于 bucket-name.s3-website.${aws_region}.amazonaws.com
.
使用此主机名,而不是从 drop-down 列表中选择存储桶。
When you specify the bucket name in this format, you can use Amazon S3 redirects and Amazon S3 custom error documents.
http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/DownloadDistS3AndCustomOrigins.html
另请注意,您的 Origin Protocol Policy 指定了 CloudFront 和 S3 之间使用的协议,必须设置为仅 HTTP。 (此设置仅back-end,front-end仍然可以是https)。