亚马逊 Route53 重定向

Amazon Route53 redirection

我在 AWS 中有一个域 example.com,并且有一个负载均衡器和一个 ec2 实例。尝试使用来自 AWS 的证书设置 https。

Route53 设置和 A 记录设置如下,用于域到负载均衡器。

域名-*.example.com

姓名:-
example.com。

类型:-
- IP4

别名目标:- 负载均衡器的 dns 名称。

我的网站是基于 spring 的网站,如果用户访问 www.example.com --->>> www.example.com/landing,它会将用户重定向到登录页面.

完成所有设置后,如果我像下面那样访问 url,它工作正常。

https://www.example.com/landing

但是如果我不使用 www 访问,

https://example.com/landing --> 它导致浏览器安全页面。(您的连接不是私有的

攻击者可能试图窃取您的信息...)

我们的证书是基于域名*.example.com.

如果我只是访问,https://example.com/ ---> It gets redirected to http://example.com/landing -- > Spring 应用程序会像这样使用 http 重定向。

http://www.test.com/landing 导致证书信任错误。 (https://example.com/landing).

如果我只是访问,获取站点无法访问错误,http://www.example.com/

如果用户使用 http 或不使用 www 或不使用任何方案访问,我正在寻找 URL 重定向到 https。不确定我是否必须在 Route53 中配置任何内容。

另外,我需要在我的应用程序中配置重定向到 https 吗?

您当前的证书should not work for the root, i.e. https://test.com

https://test.com 购买备用名称或仅使用 www.test.com 作为您的网站。您暂时不需要更改 Route53 中的任何内容。您可能确实需要在 webserver/app 中添加重定向以仅使用 HTTPS,除非您想将其留给用户。