I want to be able to have a main domain name. And additional domain names, like same domain but .net, .org or like an onion name which can be used to access and login to the site. I can configure access to view the site but not login. When logging it just gives and error. Is there an easier way to accomplish is?
AI-generated summary
In a support thread titled ‘How to allow multiple hostnames to login?’, Garrick seeks to enable login access via multiple domain names (e.g., .net, .org, or .onion) for a Discourse instance, noting that while viewing the site works, login fails. JimPas clarifies that the goal is to allow simultaneous logins from different domains and suggests this may require a plugin or new feature, similar to existing SSO integrations, and recommends consulting a Discourse team member or plugin author. RGJ proposes disabling the EnforceHostname middleware via plugin code, offering a snippet to override the hostname enforcement. However, Joker_Star reports that inserting this code into an existing plugin.rb file did not resolve the issue, indicating the workaround may not be sufficient or may require further configuration.
It sounds like you want your instance of Discourse to be available on multiple domain names (same 2nd level domain but multiple first level domains (.net, .org, etc.)) and be able to log in to the forum from each one. So if one person is on your .net domain and another is on your .org domain, you want them both to be able to log into the forum? Is this correct?
I think that may require a plugin or implementation of a new feature to do the dame thing that’s presently done for SSO for Google, Yahoo, etc. that is already built into Discourse. This will have to be answered by a Discourse team member or a plugin author.
You will need to disable this function discourse/lib/middleware/enforce_hostname.rb at main · discourse/discourse · GitHub
Plugin code would be
after_initialize do
module ::OverrideEnforceHostname
def call(env)
@app.call(env)
end
end
class Middleware::EnforceHostname
prepend OverrideEnforceHostname
end
end
I inserted this code to existing plugin.rb and checked.
but result is same.