大网数据广告活动
服务器运维问答

Redirect naked domain to www with SSL in cloudfront/route 53

· 52CE 我爱测

I have setup two buckets on s3 one for my actual angular 2 app: www.example.com and one for redirecting example.com to www.example.com. I have also created two distributions in cloud front and added a custom certificate from amaz…

问题原文

原帖链接 · alizoli · CC BY-SA 3.0

I have setup two buckets on s3 one for my actual angular 2 app: www.example.com and one for redirecting example.com to www.example.com. I have also created two distributions in cloud front and added a custom certificate from amazon. Now I have the following behaviour:

  1. www.example.com redirects to https://www.example.com -- OK
  2. example.com redirects to https://www.example.com -- OK
  3. https://example.com -- Error (This site can’t be reached)

已采纳解答

原帖链接 · Aaron St. Clair · CC BY-SA 3.0

As the comments have mentioned, this would be much easier to resolve if you provided the domain, so we can view the certificate.

As best I can gather form the information provided:

#3 is most likely occurring because you only have a SSL certificate for www.example.com. Browsing directly to https://example.com MUST present the user with a valid certificate for example.com or *.example.com. The redirect cannot occur because the browser denies the TCP connection when it receives an invalid certificate for https://example.com, before the redirect is even attempted. You should be able to fix this by getting a wildcard SSL certificate for *.example.com

#2 is probably stemming from #3, however I cannot verify this without actually investigating the domain/certificate. The fact that it's safari-specific makes me believe Safari may handle a redirect from http to a subdomain over https differently than Firefox/Chrome. I am not well-versed in Safari, but Chrome or Firefox would give you more appropriate information as to what went wrong by using the Network tab in Developer Tools. A similar toolset exists for Safari. Try using this toolset to identify the HTTP response code being returned in Safari.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2017-11-29)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。