14

我知道他们不支持,但是说真的,怎么办?将A记录指向一个仅向heroku提供301的ip?这听起来真的很愚蠢。我错过了什么吗?

有没有更简单的解决方法?

4

4 回答 4

14

有一个更简单的解决方法。

将您的 www CNAME 指向 myapp.herokuapp.com

然后将您的根 url (myapp.com) 转发到 www.myapp.com

于 2017-02-17T05:21:21.003 回答
12

According to Heroku's documentation:

Zone apex domains (aka “naked” domains or “bare” domains), for example example.com, are not officially supported on Heroku apps, because DNS forbids CNAME records on the zone apex. However, some DNS hosts provide a way to get CNAME-like functionality at the zone apex.

For each provider, the setup is similar: point the ALIAS or ANAME entry for your apex domain to myapp.herokuapp.com, just as you would with a CNAME record.

Heroku's documentation mentioned these providers with "CNAME" support for zone apex:

Besides, these providers also work:

And most DNS providers (such as ClouDNS and Namecheap FreeDNS) have free webhop / web redirect, so you don't need to setup your own web server for the redirect.

于 2012-12-24T17:58:46.407 回答
2

对于 NameCheap:@ 转到“ http://www.example.com ” www 转到“myHeroku.herokuapp.com”。

另外,请查看此答案

于 2014-11-13T04:13:27.383 回答
1

Heroku 没有自己的 DNS 管理,因此您需要将您的 dns 托管在外部并将记录指向 heroku。这是解决方案(我使用路由 53 来管理 DNS - 它是免费的)

1.将域添加到heroku- www.example.com ,之后heroku会给出一个CNAME记录

2.将此CNAME记录添加到路由53

3.创建一个名为example.com的s3存储桶并将重定向设置为https://aws.amazon.com/blogs/aws/root-domain-website-hosting-for-amazon-s3/所说的www.example.com

4.(如果不需要HTTPS,请跳过此步骤)创建云端实例并使用www.example.com的s3存储桶链接进行配置,并仅为www.example.com添加cname条目。

5.在路由53中,为example.com创建一条A记录&点别名为与s3桶相关的云端链接为example.com点别名s3桶的example.com

6.完成

于 2019-09-29T22:04:07.247 回答