我有一个使用SSL证书设置的Heroku应用,并且我的DNS不允许Apex级别的CNAME记录.意思是,我不能将A记录指向我的Heroku应用URL(A级记录只能是IP地址,而Heroku无法提供静态IP).
I have a Heroku app set up with SSL certificates, and my DNS does not allow CNAME records at the Apex level. Meaning, I cannot point my A Record at my Heroku app URL (A level records can only be IP addresses and Heroku cannot provide a static IP).
还有其他建议使用其他DNS提供程序的方法(包括在堆栈上和heroku的指南中),但是我想尝试通过AWS(特别是Route53)解决此问题,同时还将我们的保留在域中用于SSL.
There other methods (both here on stack and on heroku's guides) that recommend using other DNS providers, but I would like to try and solve this with AWS (Specifically Route53), while also retaining our in the domain for SSL.
我找到了一些有关如何执行此操作的指南,但似乎有些复杂(标头混乱,无法保留https等).我将在下面提供概述我如何实现这一目标的答案,但鼓励讨论我的解决方案可能会产生什么影响.
I found some guides on how to do this, but there seemed to be complications (headers messed up, cannot retain https etc). I will provide an answer below outlining how I achieved this, but encourage discussion on what repercussions my solution may incur.
推荐答案我在Heroku网站上发现了该指南: 为您的Heroku应用配置Amazon Route 53 DNS
I discovered this guide on the Heroku website: Configuring Amazon Route 53 DNS for Your Heroku App
解决方案的概述是创建一个S3存储桶作为静态网站主机,该主机仅重定向到您的Route53托管区域.这是基本步骤:
The outline of the solution is to create an S3 bucket as a static website host that simply redirects to your Route53 hosted zone. Here are the basic steps:
就是这样!在您的名称服务器上的TTL过期后,您的网站应该已启动并正在运行,并且example和www.example
And that's it! After the TTL expires on your Name Servers your site should be up and running and both example and www.example
更多推荐
Heroku使用AWS从example.com重定向到www.example.com并保留HTTPS
发布评论