大网数据广告活动
服务器运维问答

Using Route53 to point apex/root domain to Heroku application

· 52CE 我爱测

This is something that I've seen discussed in some other places, but this issue in particular hasn't been spelled out exactly as not being possible. I want to point an apex domain to a heroku app ( example.com to example.herokuap…

问题原文

原帖链接 · Pablote · CC BY-SA 3.0

This is something that I've seen discussed in some other places, but this issue in particular hasn't been spelled out exactly as not being possible.

I want to point an apex domain to a heroku app (example.com to example.herokuapp.com)

CNAME doesn't seem to be possible, because they are not allowed at the apex level (sub domains are fine).

ALIAS records seem to be an option, even though I don't fully understand them, or if they are standard. We use AWS Route53 as our DNS provider, but ALIAS records only seem to be possible to use for specific Amazon services (s3 website, load balancer, ..)

So is it possible to point an apex domain to a Heroku app? Is my only other option to use another DNS provider?

Thanks

EDIT: I'm aware that I can CNAME www.example.com to example.herokuapp.com, and then redirect from example.com to www.example.com using an ALIAS record, and an S3 site that redirects. But what we want is the exact opposite, we want the browser to show example.com.

已采纳解答

原帖链接 · Michael - sqlbot · CC BY-SA 3.0

Alias record are not an actual DNS record type -- they are pointers to other records within Route 53, so the target of an Alias record can only be an S3 bucket, an Elastic Load Balancer, a CloudFront distribution, or another record of the same type (e.g., an A record) within your hosted zone. Route 53 uses its internal database to find the target and return a standard DNS response.

So it is not directly possible to point an Alias to an external destination.

If you really want to point an Alias at an external destination, it is indirectly possible using CloudFront, because CloudFront accepts a hostname (example.herokuapp.com) as the name of the Origin server where requests will be forwarded. It also allows you to use an SSL certificate generated by Amazon Certificate Manager, and to selectively route different path patterns to different destinations (such as routing /images/* to an S3 bucket, for example). The caching behavior of CloudFront can be customized or disabled, if you don't want it.

This will, of course, incur usage charges for requests and bandwidth, but provides some additional capabilities that might be worth it, including relieving load on your heroku service if caching is something you could benefit from.

There are, however, valid reasons for using the www hostname rather than the bare domain, and configuring the bare domain to redirect incoming requests to www, which can be done in a number of different ways.

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

资料来源与适用范围

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

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

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