Using CNAMEs

Introduction

The way DiscourseHosting works is as follows. You choose a name for your forum and we use it for creating a hostname in our own domain, e.g. yourname.discoursehosting.net.

Of course, 95% of our customers are not satisfied with that. You will probably want your forum to be available as forum.yourdomain.com, community.yourdomain.com or whatever.yourdomain.com. We support that by giving you the opportunity to set up an ‘external hostname’ for your forum in our control panel. Configuring this is a two-step approach:

  • First, you configure your DNS so forum.yourdomain.com points to yourname.discoursehosting.net. “Pointing to something” in DNS is accomplished by using a so-called CNAME record. When you create a CNAME record, you don’t configure an IP address, but you refer to the hostname in our domain (yourname.discoursehosting.net) instead. This allows us to change the IP address of your forum without needing your help to reconfigure your DNS. We need to be able to do that in case we migrate your forum to a different server in case of upgrades or emergencies.
  • Second, you configure forum.yourdomain.com as the external hostname in our control panel. This way our servers know that this hostname belongs to your forum.

Ok. Well, that sounds easy. You just never, ever use an IP address in an A record. Always use a CNAME and you’re fine.

But wait… why this knowledge base article? There must be something that complicates this, right?

There indeed is. There is an issue when you don’t want to use forum.yourdomain.com or community.yourdomain.com, but you want your forum to become available at yourdomain.com. This is a so-called apex or naked domain, and it is impossible to configure a CNAME record on it.

Previously, we allowed customers to use an A record as an exception in such cases, but we turned out to have too many issues with that. That is why we have stopped supporting that setup in May 2019.

If you want to use yourdomain.com for your forum anyway, you have two options.

Option #1: don’t.

No, seriously. There are many more (security) issues with using a naked domain name. It’s outside of the scope of this article, but we generally recommend against it. Just use www.yourdomain.com, and redirect yourdomain.com to www.yourdomain.com.

We have a special redirection service for this case. Just configure the IP address for your domain to 45.55.96.103. It will cause a redirect-to-www.

Your DNS setup will look as follows:

yourdomain.com:

@ type: A value: 45.55.96.103
www type: CNAME value: yourname.discoursehosting.net

and then you can proceed setting up your forum where www.yourdomain.com will end up at yourname.discoursehosting.net.

Option #2: use a DNS provider that uses CNAME flattening

CNAME flattening is a trick that is used by some DNS providers in order to work around the CNAME-on-a-naked-domain restriction. You can read more about it here. As of today, we support Cloudflare as a DNS provider for this setup. A Cloudflare account is free. You can sign up here and read more about using Cloudflare with DiscourseHosting here, because you need to pay attention to some other things with Cloudflare.