We were previously running a Discourse multisite setup with around 22 different forums. Recently, we decided to remove the multisite configuration and keep only the default site:
Default site now:forum.mamapedia.com Removed old multisite domain:forum.employ.com (and 21 others)
The Issue:
Even after disabling the multisite setup, the old multisite domains can still serve the default forum (forum.mamapedia.com). For example:
Visiting forum.mamapedia.com works as expected
But visiting forum.employ.com still loads the Mamapedia forum
We expected that old domains like forum.employ.com would either:
Show an error (since they are no longer configured)
Redirect properly or be completely inactive
Setup Notes:
We are using Cloudflare’s SSL certificates with the proxy option enabled (traffic does not go directly to our server).
We can remove the A records for the old domains, but we really want to identify and fix the root cause instead of relying on a DNS-based workaround.
Steps Taken So Far:
Removed multisite settings from discourse.conf and database
Restarted Discourse and verified the app.yml settings
Cleared cache and tested in incognito mode
Expected Behavior:
forum.mamapedia.com should continue working
forum.employ.com and other old domains should not serve the Mamapedia forum
Questions:
How can we properly remove the old domains so they do not serve the default forum?
Do we need to adjust Nginx/Traefik settings, Cloudflare settings, or is there a Discourse-specific configuration we missed?
You need to switch to a standard install. The stuff you’ve done to make it be multisite is to make it possible for the server to serve a bunch of domains.
If you make a new server and restore the backup then you can’t break anything since you’ll just switch back to the old one.
The only catch is that you need to point the dns to the new server while you rebuild so it can get a certificate. And make cloudflare dns only.
The reason this is happening is simple. Multisite will select a forum based on hostname. A non-multisite install will happily accept whatever hostname you point to it. So as long as you have all the old hostnames directed to that install, it will serve the remaining site on all those hostnames.
Having the old records point at your site, is the root cause.
Cleaning up your old configuration is not a workaround, it is the solution.
OMG. I don’t remember the last time that I disagreed with you on a matter of fact. As a rule, when I see your avatar in a topic that I’ve commented on, I know that I’m going to learn something!
That’s true. They claim, though, that they switched to a standard install. I don’t believe them.
For several years now (but I think since let’s encrypt was available), on a standard install if you access it via any other hostname it’ll do a redirect (you can easily check by using the IP number and I just did another by setting forum.bigmouth.bass in /etc/hosts to a standard install and it redirected as expected. If you access it via https, which most browsers do by default now, you’ll get a certificate error.
If all that was required to access your site via some other hostname was DNS then anyone could hijack your site by creating a DNS record pointing to your site.
I think this is the magic:
My guess is that the app.yml still has something like this:
We have checked app.yml, and there are no custom redirect configurations or overrides. However, our instance still isn’t redirecting unknown hostnames to the main domain.
Nginx Configuration: Is there a way to verify if the redirect logic from templates/web.ssl.template.yml is actually being applied? Should we manually check the generated Nginx config inside the container?
Discourse Debugging: Are there any logs or commands we can run inside the container to confirm that Discourse is handling hostnames correctly?
Other Potential Causes: If app.yml is clean, what else might prevent the expected redirect behavior? Could Cloudflare or another setting be interfering?
Would appreciate any pointers to dig deeper into this!
Do the old domains all have the orange cloud turned on? Does riding off the orange cloud solve the problem? If so, then, as I expected all along, Richard is right and you need to clean up your setup.
But if using cloudflare allows a bad actor (you in this case) to serve someone else’s site on their domain, that seems like a problem.
We already removed old domains but yes , they were having orange button enabled , the issue now if anyone got our server IP and a record there with enabling proxy option it will server our site with there domain
You should run discourse-setup to make sure that you really have a standard installation. If you paste your old app.yml then you might have something in there that does not belong. I’m still not quite convinced that you have a standard setup.
I’m still not convinced that’s the case, but if it is, there’s nothing you can do about it.
Hmm. Well, if it were the main site, I’d expect that path to be https://forum.mamapedia.com/user_avatar/forum.mamapedia.com/jakeatgetit/24/5872_2.png, but that doesn’t work either.
If you’ve still got the old site, I’d take a backup of this one and restore it on the new site.
Thanks @pfaffman , what I have done so far seems working.
I got into the old server and moved the data form /var/discourse/shared/standalone/uploads/default to the same path on the new server and all user avatars and posts came back
The new issue is that site branding is not working even if I try to update it.
Checking back here to see if anyone has any ideas. We are very close to closing this out on our end, just need some assistance in trouble shooting the ‘non-logo’ saving issue. Thanks in advance for any ideas to solve it!