ac360
ac360

Reputation: 7835

Heroku + Rails: How to allow my Users to add their own Custom Domains

All over the internet there are tons of posts about this, but no answers.

In my Rails app running on Heroku, can I allow my Users to add their own Custom Domains automatically? Does Heroku allow this?

Upvotes: 15

Views: 2082

Answers (2)

John Beynon
John Beynon

Reputation: 37507

Yep, it's definitely possible - you have to use the Heroku gem within your application and when they add domains you need to make an API call to add their chosen custom domain to your application.

If you want to be able to use SSL it won't work AFAIK because you can only have one SSL addon per app - however, subdomains are easier since you can do a wildcard subdomain and then it's also possible to use a wildcard SSL on your domain without having to involve making API calls and you then don't have to get your clients edit their DNS to point at your application.

Upvotes: 6

mipadi
mipadi

Reputation: 411390

Here's one solution to allow this:

  1. Set up a wildcard subdomain (for your app's domain) that points to your Heroku app.
  2. Allow users to set a custom subdomain.
  3. Users can then set up a CNAME (or ALIAS or ANAME, as described here) that points to their custom subdomain on your app.

Upvotes: 6

Related Questions