Www works -- apex root domain does not

AI-generated summary

In the discussion “Www works – apex root domain does not,” KasperNymand is experiencing issues with their Discourse setup on the root domain https://worldcitizen.io. The subdomain https://www.worldcitizen.io works correctly with a Let’s Encrypt certificate, but the root domain shows a certificate error and redirects to a Discourse page.

KasperNymand has set up two DNS records on Cloudflare for CNAME Flattening, but is unsure if this setup is correct. codinghorror suggests setting up DNS redirects via the DNS control panel.

Two possible solutions are proposed: setting up a Forwarding URL in Page Rules on Cloudflare, as suggested by KasperNymand, or setting up a Cloudflare rule, as suggested by itsbhanusharma. pfaffman recommends using forcewww.com to solve the problem.

I’ve set up Discourse using the Discourse Standard Hosting discourse.org.

Discourse is set up at the root domain: https://www.worldcitizen.io
https://www. works, but https:// does not.

https://www.worldcitizen.io navigates correctly to the Discourse setup with a Let’s Encrypt certificate. https://worldcitizen.io however shows a NET::ERR_CERT_COMMON_NAME_INVALID and sends you to a discourse.org page where it says “Sorry, the site you are looking for does not exist.”, but it still shows the https://worldcitizen.io domain in the address bar, but indicated as insecure since it’s running on a .discourse.org certificate.

The domain is registered with DreamHost, but the DNS is running on Cloudflare for CNAME Flattening - allowing for Discourse to run on the root domain.

I’ve set up the DNS on Cloudflare with two DNS records:

CNAME // worldcitizen.io // worldcitizen.hosted-by-discourse.com. // TTL Auto // DNS only
CNAME // www // worldcitizen.hosted-by-discourse.com. // TTL Auto // DNS only

I previously had the domain running on another service which did automatically set up SSL certificates for the domain through Let’s Encrypt. Could that be what is causing some mismatch now? Is the https:// just not set up to direct correctly to the Discourse? Or, is something else wrong in my setup?

Any assistance is greatly appreciated. Thank you!

You are referring to the apex (bare, root) domain versus the subdomain?

example.com

to

www.example.com

This is something you have to set up via DNS redirects and your DNS control panel – that’s usually done via same website you purchased your domain name from.

Thank you for your quick response.

I just want both the apex root and the subdomain to work.
Shouldn’t the DNS records written above already do that - with CNAMEs for both @ and www?

Or do I need to set up a Forwarding URL in Page Rules on Cloudflare?
https://worldcitizen.io/* // Forwarding URL // 301 - Permanent Redirect // https://www.worldcitizen.io/*

I’m not completely familiar with these things.

Setup the cloudflare rule as:

worldcitizen.io/* 301
https://www.worldcitizen.io/$1

See forcewww.com. It’s designed to solve your problem.