Skip to content

Instantly share code, notes, and snippets.

@mikestone14
Created April 23, 2014 00:08
Show Gist options
  • Select an option

  • Save mikestone14/11198630 to your computer and use it in GitHub Desktop.

Select an option

Save mikestone14/11198630 to your computer and use it in GitHub Desktop.
Getting a GoDaddy domain to point to a Heroku app.

Pointing a GoDaddy domain to a Heroku app

https://devcenter.heroku.com/articles/custom-domains http://thenomadicfreelancer.blogspot.com/2012/08/pointing-godaddy-domain-to-your-heroku.html

1) Custom Subdomains

For each custom subdomain use domains:add in the Terminal.

heroku domains:add www.example.com

2) Subdomain DNS

Go to the domain's DNS manager and configure it with a CNAME record pointing the subdomain to your herokuapp.com hostname.

Record Name Target
CNAME www example.herokuapp.com

To check that this worked correctly run host www.example.com

3) URL Forwarding

This will work to have www.example.com forward to www.example.herokuapp.com, but it won't work if a user types example.com into the browser.

To get this to work, go to the GoDaddy domain information and set forwarding to www.example.com.

Done!
@bialikover
Copy link
Copy Markdown

I needed to redirect the @ domain to:
50.63.202.1
according to this article:
http://support.godaddy.com/help/article/5289/updating-your-domain-names-ip-address-for-forwarding?locale=en

@initFabian
Copy link
Copy Markdown

If youre ever in Houston, I'll buy you a beer.

Thanks!

@davidmccoy
Copy link
Copy Markdown

@bialikover thank you!

@btoone
Copy link
Copy Markdown

btoone commented Jul 2, 2016

@mikestone14, when I do this it ends up with the Heroku app url in the address bar (aka a 301 redirect) instead of my custom url? I setup the CNAME and I pointed A record to 50.63.202.1 as per @bialikover link. Any idea how to keep my custom url in the address bar (I swear this use to be easier)?

@btoone
Copy link
Copy Markdown

btoone commented Jul 6, 2016

Update: The redirect was happening because I didn't realize Rack::CanonicalHost was in place in my app (a default of Suspenders). The APPLICATION_HOST env variable was set to the Heroku app URL instead of the custom URL. Once I updated the env variable everything worked as expected.

@secondstar
Copy link
Copy Markdown

@caspyin, good point about APPLICATION_HOST env. Thanks!

@dhg
Copy link
Copy Markdown

dhg commented Jan 16, 2017

This saved me a bunch of time futzing with GoDaddy. Thx man!

@andresgarciag
Copy link
Copy Markdown

Thanks Man this info same me a lot of time on godaddy , awsome info 👍

@mgrigajtis
Copy link
Copy Markdown

This does not work.

@LisaBee224
Copy link
Copy Markdown

@caspyin I'm having the same problem you did--but I can't find where APPLICATION_HOST is in my Rails app! Did you just go to config/environments/production?

@droidjavier
Copy link
Copy Markdown

As other said, saved a lot of time. Thanks!

@labanino
Copy link
Copy Markdown

labanino commented Apr 3, 2017

I added the domain in Heroku like this, www.mysite.com instead of mysite.com but if I typed in the browser mysite.com I got the Godaddy parked page but the domain forwarding did the trick for the last. Thanks a lot!

@dkumarlinux
Copy link
Copy Markdown

I tried to do so many time to add cutom domain with heroku by command
heroku domains:add www.mysite.in
Adding www.mysite.in to ⬢ guarded-atoll-####... !
▸ Please verify your account in order to add domains (please enter a credit card) For more information, see
https://devcenter.heroku.com/categories/billing Verify now at https://heroku.com/verify

Even www.mysite.in shows heroku purple page
but not working anymore..

@artemv
Copy link
Copy Markdown

artemv commented Oct 11, 2017

Just tried it, all went fine except the forwarding that just didn't work at all for my domain. After setting up the forwarding www.mysite.in worked but mysite.in connection timed out. Setting IP manually as per bialikover's link didn't change this.

Resolved only by setting up Cloudflare (free) account and switching GoDaddy domain settings to its nameservers - then all worked like a charm.

@BFMarks
Copy link
Copy Markdown

BFMarks commented May 22, 2018

I will never use Go Daddy again - terrible

@YahiaBadr
Copy link
Copy Markdown

YahiaBadr commented Oct 14, 2019

this sounds great! i noticed that my domain on godday is not secured ( not https) however my deployment link on heroku is secured ( uses https) how could i make my domain uses this certificate without buying or renting a certificate that worth a lot of money?! I am using Node and Express as server side, and React as client side. Please if you know something that could help me to make my domain certified and secure i will be thankful!

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