大网数据广告活动
网站运营与故障问答

Heroku apps, DNS and MX records

· 52CE 我爱测

I have a domain, example.com , for my mom's business. I'm having trouble configuring the records to allow the Heroku app to exist simultaneously with email through Microsoft Office 365. The site should be accessible by www.exampl…

问题原文

原帖链接 · Chris Cirefice · CC BY-SA 4.0

I have a domain, example.com, for my mom's business. I'm having trouble configuring the records to allow the Heroku app to exist simultaneously with email through Microsoft Office 365. The site should be accessible by www.example.com and https://example.com. It is currently only working with the www version.

The issue is that I need a CNAME record pointing to example.com, but can't use host = @ because it will break the MX records due to the priority of CNAME.

Here's my current configuration:

TYPE  | host | value                                       | TTL
----------------------------------------------------------------
CNAME | www  | www.example.com.herokudns.com.           | 60
MX    | @    | example-com.mail.protection.outlook.com. | 60

This works. But the site isn't accessible at example.com (without the www). I would like to make it:

TYPE  | host | value                                       | TTL
----------------------------------------------------------------
CNAME | @    | example.com.herokudns.com.               | 60
CNAME | www  | www.example.com.herokudns.com.           | 60
MX    | @    | example-com.mail.protection.outlook.com. | 60

But then her email stops working. How can I make the site accessible at example.com?

已采纳解答

原帖链接 · Stephen Ostermiller · CC BY-SA 4.0

Putting a CNAME record at the root of your domain breaks email. If you want email to work, you just can't do that.

Heroku has instructions for this case. You need to use a DNS host that supports "alias" records. They are also sometimes called "aname" or "proxy" records. Those are served as normal A records with an IP address, but the server periodically looks up that IP address from a host name.

NameCheap has Tweeted that they don't support ANAME records, so you will have to move to a new DNS host that has such a feature. The Heroku instructions list several that do.

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

资料来源与适用范围

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

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

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