Help with URLs not working on Chrome

I know this is not directly related to Discourse, but since it’s my forum using Discourse, here it is:
I’m trying to make sure that all versions of a URL work and direct people to my forum. Those versions are:

http://domain.com
http://www.domain.com
https://domain.com
https://www.domain.com
www.domain.com
domain.com

These versions are not working, when Chrome is set to incognito:

http://www.domain.com
www.domain.com

I get this:

I’m using Cloudflare and I already created a Rule to redirect domains, suggested by ChatGPT (since I’m not an expert), but it’s not working.

Any suggestions of what might be causing this?
This is a subdomain like forum.domain.com, not sure if that’s the issue?
Because if I use the same format, but with the main domain domain.com, it works.

I know this is a very specific scenario, but I would like to make sure that all options in all browser “states” are covered.

Thank you!

2 Likes

This guide should help to setup additional domains with let’s encrypt: Set up Let’s Encrypt with multiple domains / redirects.

As for the redirection, it’s handled automatically:

2 Likes

I will check this tomorrow, but what I don’t get is that everything works on Chrome and Safari, for example, but in incognito in Chrome, those 2 versions don’t work. So the certificate seems to be working, the one that Cloudflare offers by default. Or am I missing something here?

1 Like

You can let Discourse handle the domain and certificate by following the guide above.

Or, since you’re using Cloudflare, you can also create a redirection from www.domain.com to domain.com; see this tutorial : https://community.cloudflare.com/t/redirect-www-example-com-to-example-com-using-single-dynamic-redirects/636764.

1 Like

Thank you for the link.

Following their first instructions, I’m creating this:

Their instructions were for the main domain, not a sub domain, so I guess I’m doing it right?

When I save, I see this warning icon with this message. Is this normal?

Then I go to the rules:

Is this how it’s supposed to look like? And does this rule affect when the url has something after the /? For example forum.alltiago.com/tags?

They mention that this can take up to an hour to reflect the changes, so I will wait. Let me know if there’s something I missed.

Thank you!

1 Like

Oh, you’re already using a forum subdomain.

You see this warning about SSL because the free Universal SSL certificate provided by Cloudflare covers only one subdomain level. It won’t work on www.forum.domain.com.

I think it’s easier to follow the guide in my first message and let discourse/let’s encrypt (for free) handle www.forum..
What you should do:

This way:

  • any HTTP request redirects to https://forum.alltiago.com
  • www.forum.alltiago.com redirects to forum.alltiago.com

I tested myself on my side, and it’s working great.

1 Like

The only things with the word forum (I deleted the AAAA already):

When I try to create it I get this:

I guess I will have to delete the A record with the name www.forum? If so, what about the other A record?

I will check that. Let’s see if I can follow it…

What’s weird is that for example http://www.forum.alltiago.com works when Chrome is not in incognito, but stops working when it is.
www.forum.alltiago.com doesn’t work on any of those.

I didn’t know Discourse comes with a certificate?
What would be the difference in using that vs Let’s Encrypt?
As a starter on everything Discourse, I’m trying to work with what brings less complexity so I don’t get too confused. If Discourse can handle that, awesome. I would still like to understand why pick one over the other, if you don’t mind sharing?

Thanks!

1 Like

Yes, remove the one with an A record; use CNAME instead.

Just enter your domain in the input, then copy-paste the whole output into your app.yml config file, as I showed you in the screenshot! Be careful with the indentation!

Are you sure Chrome doesn’t automatically remove www, which you overlooked? I don’t see other explanations.

No, no. Discourse uses Let’s Encrypt! Sorry for the confusion. That’s why, you should use it, it’s free and easy.

But both A records or just the one with the www.forum name?

Like this?

So I still need to create an account with Let’s Encrypt?
I remember when I was installing Discourse, one of the optional steps at the bottom of the instructions was to install Let’s Encrypt but I haven’t yet. So maybe after all of this is done, which I believe it is now, I should check those instructions, right?

The one with www.forum. You want to replace A to CNAME record.
www.forumforum.alltiago.com
Remember, no proxy!

The guide is for additional domains!
So, you want to add www.forum.alltiago.com instead.
forum.alltiago.com is already being handled by default.

Otherwise, the location and indentation seems correct.

You have nothing to do! Just add the additional domain, rebuild.
Let’s encrypt will issue a certificate automatically.

Additionally, if you haven’t seen it yet, you might find this Cloudflare guide helpful: https://meta.discourse.org/t/using-discourse-with-cloudflare-best-practices

2 Likes

Too much “excitement” for a single day hahaha
But I saved that page for future reference.
Thanks! :flexed_biceps:

2 Likes