Multiple subdomains, multiple apps in Heroku

For a variety of reasons we sometimes want to have multiple subdomains point to one heroku app, and then have another ‘main’ app or webpage pointed to by www. It’s easy to configure. The other explanations I read are a little general, here are the specifics…

The explanation at heroku is very good, at : http://docs.heroku.com/custom-domains (there’s even a very good screencast shows step by step)

the key thing is if your ROOT domain (mycoolsite.com) is at Heroku you want to create THREE “A” records, because they do some fault-tolerant crossover magic. So you’d have an A record for

75.101.163.44
75.101.145.87
174.129.212.2

Now for each subdomain you create a C record

www -> proxy.heroku.com
client1 -> proxy.heroku.com
client2 -> proxy.heroku.com
client3 -> proxy.heroku.com

NOW on the Heroku side, you have two apps right? The ‘main app’ and the saas app.

Login, and for each app go to Resources -> Addon -> Get More Addons ->Custom Domains (free)

for the main app, add ONE domain: www.mycoolsite.com

for the saas app, add each of the clients, eg:

client1.mycoolsite.com
client2.mycoolsite.com
client3.mycoolsite.com