Discourse is only accessible by IP address

AI-generated summary

railsnoob is having trouble accessing their Discourse forum by domain name (forum.example.com) instead of IP address. They tried setting an A record on GoDaddy as suggested by Jeff Atwood, but it didn’t work. pfaffman suggested checking the domain resolution using commands like dig and whois. railsnoob eventually got it working by setting a CNAME record, but pfaffman suggested that a single A record would be a better approach. The issue was also partly due to the browser automatically adding www to the domain name, as mentioned by railsnoob.

My discourse forum is accessible only from the IP address, not forum.example.com

In this post Jeff Atwood states:

PLEASE do not link to advice that tells people to set their DNS servers to digital ocean’s. That is seriously toxic. (and why is DO telling people to do this? Awful.)

Rather, all they need to do is go to their existing DNS registrar – the same place they purchased the domain name from, usually – and add an A record pointing to the IP.

I have attempted this on godaddy by changing the default A record to:

A →
Host: forum
Points To: IP address of discourse forum

but it does not work.

My current DNS has only been modified so far to:

CNAME → www → www.example.com.herokudns.com

I have seen in another topic where someone was told to check their app.yml file to make sure the subdomain is correct but I do not know how to do that starting from root@disocourse (discourse being the name of my Digital Ocean droplet)

We can’t really tell without your hostname. You can do things like this to see if your domain is resolving correctly:

dig test.com # does the name resolve?
dig test.com @8.8.8.8 # does Google think so?
whois test.com
dig test.com @NAME SERVER LISTED IN WHOIS results

OK I got it working like this please confirm if this is optimal or if there is a better method?

A server 128.199.115.233
CNAME forum server.example.com

per this topic

Unless you have a specific reason to have two names point to your Discourse, then it would be better to just create one A record.

You are correct. The trouble it seems I was having was that my browser keep insisting on inserting www in front of forum.example.com