AWS S3 CloudFront-从https://www.domain.com重定向到https://domain.com [英] AWS S3 CloudFront - redirect from https://www.domain.com to https://domain.com

查看:77
本文介绍了AWS S3 CloudFront-从https://www.domain.com重定向到https://domain.com的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的AWS Route 53设置:

Here is my AWS Route 53 Setup:

https://www.migranthire.com 不起作用。我如何从该域重定向到 https://migranthire.com

The domain https://www.migranthire.com doesn't work. How can i redirect from this domain to https://migranthire.com

推荐答案

您的 www 网站直接指向S3存储桶网站托管端点,该端点负责重定向到不带 www 前缀的域名。

Your www site is pointing directly to an S3 bucket web site hosting endpoint, which is taking care of the redirect to the domain name without the www prefix.

S3网站终结点不支持HTTPS ,因此仅适用于http。

The S3 website endpoints do not support HTTPS, so this works for http only.

您的解决方案是创建第二个CloudFront发行版-您需要另一个发行版,因为第二个发行版的来源不同。使用您的SSL证书配置此分发,配置为以www主机名作为替代名称,并将其来源设置为www存储桶-但是,当您设置第二个CloudFront分发时,请勿从列表中选择存储桶的名称。而是输入网站端点主机名- www.migranthire.com.s3-website-eu-west-1.amazonaws.com 。将原始协议设置为仅HTTP(即使浏览器协议为HTTPS,CloudFront也必须将请求作为HTTP发送到存储桶。您仍然会获得绿色锁。)

Your solution is to create a second CloudFront distribution -- you need an additional one, because the second one has a different origin. Configure this distribution with your SSL certificate, configured to expect the www hostname as an alternative name, and set its origin to the www bucket -- however, when you are setting up this second CloudFront distribution, do not select the name of your bucket from the list. Instead, enter the website endpoint hostname -- www.migranthire.com.s3-website-eu-west-1.amazonaws.com. Set the origin protocol to HTTP only (CloudFront has to send the request to the bucket as HTTP even if the viewer protocol is HTTPS. You still get a green lock.)

然后,将Route 53配置为将www请求发送到新的CloudFront分发,而不是直接发送到存储桶。 CloudFront将说出SSL,并将请求发送到S3,S3将返回重定向,就像现在这样。

Then, configure Route 53 to send www requests to the new CloudFront distribution, instead of directly to the bucket. CloudFront will speak SSL, sent the request to S3, which will return the redirect, as it is doing now.

这篇关于AWS S3 CloudFront-从https://www.domain.com重定向到https://domain.com的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆