How to allow multiple hostnames to login?

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?

1 Like

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 https://github.com/discourse/discourse/blob/master/lib/middleware/enforce_hostname.rb

Plugin code would be

after_initialize do

  module ::OverrideEnforceHostname
    def call(env)
      @app.call(env)
    end
  end

  class Middleware::EnforceHostname
    prepend OverrideEnforceHostname
  end

end
5 Likes

I inserted this code to existing plugin.rb and checked.
but result is same.

1 Like