How to offer custom domains for my Saas app in heroku?

I want to offer custom domains for my clients in heroku.

Having my domain, www.xpto.com and my user domains, user1.xpto.com, user2.xpto.com, I want to give them the opportunity to add a CNAME record pointing to my application. The user domain www.user1xpto.com points to user1.xpto.com.

How can I achieve this with Heroku?

Thank,

+5
source share
4 answers

If you add one of the additional domains to your application , you can do this using the Heroku gem.

class CustomDomain < ActiveRecord::Base
    belongs_to :user
    after_create :setup_at_heroku
    def setup_at_heroku
       # make calls with heroku gem here
       test_cname_later
    end
    def test_cname_later
      # use background job here to try to call custom.com/custom_domains/activate
    end
end

/custom _domains/activate, .

+5

, Heroku, Heroku REST API, , .

0

, , , heroku , .

-1

All Articles