LoginSignup
9
6

More than 5 years have passed since last update.

HerokuでRoot domainを設定したい

Posted at

www.example.comじゃなくて、example.comみたいなドメインをRoot domain、Naked domain、Apex domainとか呼ぶけれども、このようなドメインはAレコードでIPを直接指定する必要があるので、HerokuみたいにCNAMEを設定しないといけないサービスには基本的には使えない。

Zone apex domains (aka "naked", "bare" or "root" domains), e.g., example.com, using conventional DNS A-records are not supported on Heroku. However, there are alternative configurations that allow for root domains while still being resilient in a dynamic runtime environment.

https://devcenter.heroku.com/articles/custom-domains#root-domain

Herokuのドキュメントにはこのように書いてあって、2つほど代替の手段が紹介されてる。

一個目はApex domainに対してCNAMEのような指定ができるDNSサービスを利用する方法。以下のようなDNSサービスが対応しているらしい。

もうひとつは、example.comみたいなドメインをwww.example.comみたいなサブドメインにリダイレクトするというSubdomain redirectionという方法。

Route53を使ってる場合はS3を経由してその設定ができるらしい。

Configuring Amazon Route 53 DNS for your Heroku App | Heroku Dev Center

だいぶまわりくどい方法に見えるけどRoute53使ってる場合は現状だとこれしかないっぽい。

無理せずRoot domainは使わないというのがよさそう。

9
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
6