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:
35 Likes

A post was split to a new topic: Required DNS Settings

So it took a minute to figure out, but I managed to get my apex domain to work with Azure, where we host our DNS.

In order to use Azure you need to leverage Azure Front Door. These instructions are for Azure Front Door Standard/Premium, not Azure Front Door (classic).

  1. Navigate to Azure Front Door and click + Create
  2. Choose Azure Front Door and Custom create, and click Continue to create a Front Door.
  3. Choose your Subscription, Resource Group, Name and Tier (Standard worked for me), then click Next: Secrets.
  4. If you’re using your own SSL cert, Add it here. Once added (or if you’re letting Azure create your cert), click Next: Endpoint.
  5. Click Add an endpoint and choose a name, then click Add.
  6. Under the new “Routes” section, click Add a route. Give it a name.
  7. For “Origin group” click Add a new origin group. Give it a name.
  8. Click + Add an origin. Give it a name. For “Origin type” choose Custom. For “Host name” enter your site.hosted-by-discourse.com domain. Make sure “Origin host header” is blank. Click Add.
  9. Click Add in the “Add an origin group” dialog.
  10. Click Add in the “Add a route” dialog.
  11. Click Review + create. Click Create.
  12. Wait for the AFD to deploy. Once it’s deployed click Go to resource.
  13. On the left side menu choose Domains. Click Add a domain.
  14. For “DNS zone” choose the zone your domain is in. Under “Custom domain” pick your domain in the APEX section. Click Add.
  15. When your domain appears in the list, click the … on the right. Choose Associate.
  16. Select the endpoint and route you created earlier. Click Associate.

If you’re using an AFD Managed Certificate

  1. If the “Validation state” of your domain is Pending, click that link. Choose Minutes for the “TTL Unit” (for quick validation), then click the Add button under “DNS record status”.
  2. BE PATIENT. This is where I spent too much time pulling out my hair, but you need to wait. Eventually your “Validation state” should change to Approved.
  3. You may have to Regenerate and update the TXT DNS Record. You can do this by clicking the Regenerate button. You’ll need to click the Update button under “DNS record status” once it appears.
1 Like

FYI for anyone following this: This setup isn’t flattening DNS, it’s configuring a load balancer in Azure to proxy the origin.

This is not officially supported as is since it’ll have side effects (all visitors will come from an Azure IP, not their actual IP)

1 Like