How to change root entry to CNAME for github pages?

January 28, 2017 1.1k views
DNS

I am trying to move from NameCheap to DigitalOcean. My DNS is amirraminfar.com. Currently, in NameCheap I have amirraminfar.com setup as a CNAME to amir20.github.io.

$ dig amirraminfar.com
;; ANSWER SECTION:
amirraminfar.com.   1587    IN  CNAME   amir20.github.io.

When trying to do the same thing in DigitalOcean, I cannot change amirraminfar.com to CNAME because @ seems to be invalid.

Is this a known problem? Perhaps, it is not possible to setup a root as CNAME but then why is it working on NameCheap.

4 Answers

@amirraminfar

Different DNS providers use and allow different data to be input when creating/modifying DNS.

For DigitalOcean, you need to enter in an actual hostname in the first input box, or a short name. For example:

@    amir20.github.io.    43200

... would not be valid as a CNAME, but

amirraminfar.com.   amir20.github.io.    43200

... would be. You simply need to drop the @ and replace it with your actual domain if you're going to use DigitalOcean's DNS manager.

  • @jtittle thanks for the response. I don't think this works. Maybe I am doing something wrong. I can't upload a screenshot but when I try amirrainfar.com. I see the preview as amirraminfar.com..amirraminfar.com. Here is a screenshot.

    Also, I get the following error when trying to save.

    "Cname records cannot share a name with other records."

@amirraminfar

Since DigitalOcean doesn't support ALIAS or ANAME records (as far as I can see), which is required by GitHub in order to setup your domain if you want to route the domain itself, then you may have to fall back to your default registrars DNS and use them (if they support it).

The only other way would be to use an A entry and point that entry to the IP used by your page. The downside to this is, unlike ALIAS and ANAME entries, if GitHub changes their IP, you have to do the same, otherwise your page won't display.

I've honestly not seen too many providers that do allow such entries though, so it's not just a limitation here at DigitalOcean.

You could, of course, use a sub-domain and use a CNAME to point it, but as far as the actual domain and only the domain, you need a way to use those entries and DigitalOcean currently does not allow them to be setup from the control panel.

Hmm. Well that's a bummer. I created an ticket for DO. If they don't provide a solution, I'll have to leave it at NameCheap for now.

I'm sure you've found an answer for this already - but I'm leaving this here for anyone looking here in the future.

The best available solution is CloudFlare, it's a free DNS service that offers "CNAME Flattening" which allows you to place CNAME records at the apex/root of the domain.

They also provide free SSL which is nice.

Have another answer? Share your knowledge.