Configure your hosted Discourse site to run at the root or apex domain (e.g. example.com)

Most hosted discourse instances are on a subdomain:

forum.example.com
talk.example.com
www.example.com

This is our general recommendation in almost all cases, and it works great. However, if you wish to use a root domain or apex domain for your hosted discourse, like so

example.com

this turns out to be surprisingly difficult in a hosting scenario, due to the vagaries of how DNS works. :thinking:

It is possible, however, you must use a DNS provider that specifically supports it!

DNS provider documentation

Here is a list of known-compatible DNS providers, the name of the DNS type that you should use, and a link to their docs.

Provider Type
AWS Route53 (AWS only[1]) A & AAAA ALIAS records; click for example →
CloudFlare CNAME flattening · Cloudflare DNS docs
DNSimple ALIAS
DNS Made Easy ANAME
DreamHost ALIAS
easyDNS ANAME
Gandi ALIAS
Hurricane Electric ALIAS
Name ANAME
Namecheap ALIAS
Webcentral (formerly Netregistry) Cloaked Redirection (IPv4 only)
PointDNS ALIAS

If your DNS provider is not one of the above, you must switch to one of these DNS providers to achieve an apex domain or root domain hosted discourse.

:exclamation: If you try/test out another DNS provider and it works for you, do reply here with the name of the DNS provider, and a link that explains how they set it up, so we can update our list. There are a lot of DNS providers, so we update the list as we find, this list is by no way a one-stop-list of every DNS provider in the world that supports this.


Last Reviewed by @SaraDev on 2022-07-12T01:00:00Z


  1. this only works if you are self-hosted in AWS or on our AWS Enterprise Hosting ↩︎

Last edited by @JammyDodger 2024-05-26T07:47:45Z

Check documentPerform check on document:
「いいね!」 36

投稿が新しいトピックに分割されました: 必要なDNS設定

Azure で Apex ドメインを機能させる方法を理解するのに少し時間がかかりましたが、DNS をホストしている Azure で実現できました。

Azure を使用するには、Azure Front Door を活用する必要があります。これらの手順は、Azure Front Door Standard/Premium 用であり、Azure Front Door (classic) 用ではありません。

  1. Azure Front Door に移動し、+ 作成をクリックします。
  2. Azure Front Door を選択し、カスタム作成を選択して、Front Door の作成に進むをクリックします。
  3. サブスクリプション、リソース グループ、名前、およびレベル (Standard で機能しました) を選択し、次へ: シークレットをクリックします。
  4. SSL 証明書を自分で使用する場合は、ここで追加します。追加したら (または Azure に証明書を作成させる場合は)、次へ: エンドポイントをクリックします。
  5. エンドポイントの追加をクリックして名前を選択し、追加をクリックします。
  6. 新しい「ルート」セクションで、ルートの追加をクリックします。名前を付けます。
  7. 「オリジン グループ」で、新しいオリジン グループの追加をクリックします。名前を付けます。
  8. オリジンの追加をクリックします。名前を付けます。「オリジンの種類」で カスタム を選択します。「ホスト名」に site.hosted-by-discourse.com ドメインを入力します。「オリジン ホスト ヘッダー」が空白であることを確認します。追加をクリックします。
  9. 「オリジン グループの追加」ダイアログで追加をクリックします。
  10. 「ルートの追加」ダイアログで追加をクリックします。
  11. レビュー + 作成をクリックします。作成をクリックします。
  12. AFD がデプロイされるのを待ちます。デプロイされたら、リソースに移動をクリックします。
  13. 左側のメニューで ドメイン を選択します。ドメインの追加をクリックします。
  14. 「DNS ゾーン」で、ドメインが存在するゾーンを選択します。「カスタム ドメイン」の下で、APEX セクションでドメインを選択します。追加をクリックします。
  15. ドメインがリストに表示されたら、右側の をクリックします。関連付ける を選択します。
  16. 前に作成したエンドポイントとルートを選択します。関連付ける をクリックします。

AFD マネージド証明書を使用する場合

  1. ドメインの「検証状態」が 保留中 の場合は、そのリンクをクリックします。「TTL 単位」で を選択します (迅速な検証のため)。次に、「DNS レコードの状態」の下にある 追加 ボタンをクリックします。
  2. 忍耐強く待ってください。ここで髪の毛を抜くのに多くの時間を費やしましたが、待つ必要があります。最終的に「検証状態」は 承認済み に変わるはずです。
  3. TXT DNS レコードを再生成して更新する必要がある場合があります。これは、再生成 ボタンをクリックすることで実行できます。表示されたら、「DNS レコードの状態」の下にある 更新 ボタンをクリックする必要があります。
「いいね!」 1

これをフォローしている方への FYI: このセットアップは DNS のフラット化ではなく、Azure でオリジンをプロキシするロード バランサーを構成しています。

これは、副作用があるため (すべての訪問者が実際の IP ではなく Azure IP から来るため)、現状では公式にはサポートされていません。

「いいね!」 1