Redirect a(n apex) Domain to WWW with GoDaddy and Heroku
Solution: Don't use GoDaddy
It’s Wednesday. You’ve passed your Tuesday code-freeze because the project you’ve been working on for 6 months is about to be introduced for the first time at an industry event to hundreds of new users. The sales team is going to be talking individually with dozens of potential clients one-on-one and asking them for feedback or to sign-up.
You ask someone who hasn’t been working on the project if they can take a look and you tell them the domain to go to: example.com
“It’s not loading.”
You see, dear reader, your user did exactly what you asked them to do. They opened their browser, that place where they go to the internet. They typed in example.com. That should work.
The computer making the request should lookup which IP Address www.example.com translates to, something like 10.0.0.1, then navigate the request to the address.
Once the request reaches the computer, unless told otherwise, it attempts to make an insecure connection. You’ll recognize these insecure connections from the http at the beginning of the URL. If that insecure connection fails, it redirects to the secure connection – those https connections that everyone is always going on about.
OK, cool. So then what’s the deal with GoDaddy and Heroku? Well, Heroku won’t give you an IP Address. They want you to use their subdomains, like “wandering-mist-8998.herokuapp.com.” These are important to a platform like Heroku because if your server isn’t serving enough traffic, then, by default, they’ll turn it off and use the IP address elsewhere, assigning you a new one when you need it.
GoDaddy will only allow you to point your root (or naked/apex) domain (e.g. “example.com”) to an IP Address only. They will also allow you to redirect your subdomain (e.g. “www.example.com”) to a different name using a CNAME or canonical name record.
So, you can point a subdomain to www.example.com and it will work and redirect to the SSL port if you didn’t specify otherwise. But that apex domain doesn’t know where to go. You could look up your current IP address on Heroku, but that’s not static (unless you pay for it).
So how do we get out of this mess?
How much time do you have? No seriously it makes a difference in the answer.
First off, don’t use GoDaddy. If you don’t have a production application preparing to serve traffic in the next 48 hours, move your domain to:
- CloudFlare
- Fastly
- DNSimple
- CloudFront
- Akamai
- Google DNS
Basically anybody but GoDaddy. Heck! You could even use “redirect.pizza,” which sounds ridiculous, and I think that’s the point. Any of these solutions that require you to have time for your domain to propagate, which may take up to 48 hours. If you need your site live immediately or cannot afford to wait, moving it is not an option.
Solution
Don’t use GoDaddy if you’re a developer, publisher, aspiring zine writer, entrepreneur with the next big idea.
If you’re looking for a team to help you discover the right thing to build and help you build it, get in touch.
Published on December 6, 2023