Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

  • Are there add-ons to help with this
  • By custom domains, I mean adding using their own top-level-domain, not Subdomains. E.g., example.com
like image 625
ac360 Avatar asked May 23 '13 16:05

ac360


People also ask

Does Heroku allow custom domain?

You can buy a custom domain name with a domain registration service. Add the custom domain to your app with the heroku domains:add command. Look up the Heroku-supplied DNS target for the custom domain using the heroku domains command.

How can I add my domain to Heroku without credit card?

No, it is not possible to add a domain without adding a payment method. Adding a payment method makes your account a verified account and it also gives you 450+ dyno hours. Payment methods: Visa, MasterCard, American Express, Discover and JCB credit cards are accepted.

Is Heroku free forever?

Free Services on HerokuHeroku offers a free plan to help you learn and get started on the platform. Heroku Buttons and Buildpacks are free, and many Heroku Add-ons also offer a free plan.

How do I connect my Namecheap domain to Heroku?

First connect to the Heroku dashboard, select the heroku application and go to the "Settings" tab. Scroll down until you reach the Domain and certificates section. Click on the purple "Add domain" button and type the domain name with its subdomainyou want to use.


2 Answers

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.
like image 188
mipadi Avatar answered Oct 11 '22 07:10

mipadi


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.

like image 6
John Beynon Avatar answered Oct 11 '22 08:10

John Beynon