Naked/Root domain with heroku, Squarespace or other SaaS service

Shunsuke Sawada

We wanna use root domain!

When you are using heroku, Squarespace or other SaaS based service, you may want to use your domain instead of the domain you got from them.

You get something like this:
yourapp.herokuapp.com

but you want to make it like this:
www.cooldomain.com

also you want to user root/naked domain:
cooldomain.com
(this is called root domain or naked domain)


To achieve this, you need to change DNS setting as recommended in documentations like Custom Domains.

There are two ways.

  1. CNAME functionality at the apex
  2. Subdomain redirection   I would say the second one is easier because not so many domain register provide apex function at this moment or sometimes you may have no choice about DNS server.

Subdomain redirection

For subdomain redirection, you set CNAME and domain forwarding. If your DNS server provides domain forwarding function, you can simply follow this heroku instruction. If you are using Amazon Route 53, just follow this.
However, if your DNS server DOES NOT provide domain forwarding function, is there no way to use naked/root domain?

wwwizer

This is where wwwizer.com comes in. They provides naked domain redirect for free. The only thing you need to do is just pointing your naked/root domain to "174.129.25.170" then it'll be redirected to the subdomain with "www" in front.

So your domain setting is someting like this:
domain2

A record:
174.129.25.170

CNAME:
Provided domain from Saas like yourapp.herokuapp.com, ext.swuarespace.com ...
 

I didn't use wwwizer since I'm used to Amazon Route 53, but when I don't have fully control about a project, wwwizer turned out so handy for me.
That's it. Though, I think it's a rare case that you can't use domain forwarding function.

9
Shunsuke Sawada

おすすめの記事

Rails whereの検索で否定を使う
3
Railsを4.2にバージョンアップしたら、Vagrantのローカル開発環境にアクセスできなくなった問題
Railsのバリデーションエラー後にレイアウトが崩れるとき