Point top level domain to heroku app

戏子无情 提交于 2019-12-11 04:24:16

问题


I want to point mysite.com to myapplication.herokuapp.com

Searched hard and was speaking with hostgator support, they say - it is impossible, heroku is not supporting A records and CNAME are not able to point from naked domain.


回答1:


You can do it with A records…but Heroku really doesn't want you to, and with some good reasons. One thing you can do is run

$ host myapplication.herokuapp.com

and find out what IP that points to, and then create an A record pointing to that IP. But this is very brittle: if Heroku changes that IP, then your domain won't work until you update your A record. This method will probably break at some point, so you shouldn't do it, even though you technically can.

Luckily, there are solutions. Heroku outlines them in their documentation for custom domains, particularly in their documentation for root domains. The best one is to use a DNS provider that supports "ANAME" or "ALIAS" records, which are like CNAME records in that they point to another domain (rather than IP), but can be used for root domains. DNS doesn't natively have such support, so these are a bit of a hack, and are only supported by a few providers, namely DNSimple and DNS Made Easy. This solution is the best, most robust solution.

I use DNSimple and have found them to be very reliable and excellent to work with.




回答2:


This question was already asked and answered here: https://stackoverflow.com/a/16041655/758334

I can vouch for dnsimple. There was a number of reasons why I switched to them, but their support for ALIAS records to make pointing the apex domain to hosted cloud apps was a big one for me.



来源:https://stackoverflow.com/questions/16849324/point-top-level-domain-to-heroku-app

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!