Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save baldwindavid/205345 to your computer and use it in GitHub Desktop.
Save baldwindavid/205345 to your computer and use it in GitHub Desktop.

Heroku DNS Setup

The Goal

This is an in-progress example of a DNS setup for a Rails app that will allow members to claim a subdomain that is hosted on Heroku. Additionally, subdomain owners should have the option to use their own domain that maps to this subdomain.

The Problem

Heroku has a slightly unique DNS setup, so it seems that some DNS workarounds will be necessary.


Proposed Solution - Phase 1

Assumptions

  • The primary application domain will be example.com
  • The registrar is GoDaddy.com
  • The member's subdomain within the application is member1
  • The member's custom domain is member1.com

Primary Domain - example.com

A Records
Host  Points To  	    TTL
* 	  75.101.163.44 	1 Hour
* 	  75.101.145.87 	1 Hour
* 	  174.129.212.2   1 Hour
Heroku Custom Domain Additions
*.example.net

Member's Custom Domain - member1.com

A Records

Host  Points To  	    TTL
@ 	  75.101.163.44 	1 Hour
@ 	  75.101.145.87 	1 Hour
@ 	  174.129.212.2 	1 Hour

CNAMES

Host  Points To  	      TTL
www 	proxy.heroku.com 	1 Hour
Heroku Custom Domain Additions
member1.com
www.member1.com

At this point, member1.com, www.member1.com and member1.example.com should all reach the application.


Proposed Solution - Phase 2

The Rails application will now be tasked with discerning the subdomain associated with member1.com, www.member1.com and member1.example.com. Initial plans will be to get this subdomain and then use subdomain-fu just as would be done for a normal DNS setup. More to come...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment