Sign up ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

GitHub updated their Pages service for custom domains yesterday and I'm not clear on one small detail. They recommend a CNAME record for but do not recommend using A records for the apex domain.

I want to make sure both and resolve correctly to, and also get the benefit of GitHub's new CDN. Do I use a CNAME for www only then, with no A record at all?

This feels like a dumb question as I type but I'm just not getting it.

share|improve this question

2 Answers 2

up vote 3 down vote accepted

Do I use a CNAME for www only then, with no A record at all?

You would need to use a CNAME for the subdomain, and an ALIAS record for your root domain (aka., "apex domain").

As indicated in the help document you provided on Setting up a custom domain with Pages:

Some DNS providers (like DNSimple) allow you to use an ALIAS record to point your custom apex domain to If your DNS provider supports this it will allow us to provide the full benefits of our Content Delivery Network to your Page.

Elaborating on this using their DNSimple reference, an ALIAS record is:

...a virtual record type that we created to provide CNAME-like behavior on apex domains.

For example, if your domain is and you want it to point to a host name like, then you cannot use a CNAME record, but you can use an ALIAS record. The ALIAS record will automatically resolve your domain to one or more A records at resolution time and thus resolvers see your domain simply as if it had A records.

The example DNSimple provides for setting an ALIAS record is here (substitute for the Heroku server in that example).

For other DNS providers, see their support docs on how to set an ALIAS record to a subdomain. If your DNS provider does not support setting ALIAS records, then you'll have to use an A instead, which will not provide the benefit of GitHub's CDN.

share|improve this answer
Yes I saw all this the docs but unfortunately ALIAS records aren't a recognised DNS record type and require the use of a third-party paid service. I think I'm asking too much here of the free service & I'll forget the CDN for now. Free GitHub Pages hosting + Free CDN + Free www and non-www working isn't yet possible. Thanks for the answer though. – Tom Brossman Jan 9 '14 at 12:07
No problem - yes, it depends on whether you have a DNS provider that supports ALIAS records. – dan Jan 9 '14 at 12:18
@TomBrossman The ALIAS record is not a standard DNS record, unfortunately there is no standard at the moment for such feature (that's why we came with the ALIAS. Disclaimer: I work for DNSimple). Just a few (paid) DNS providers offer this proprietary feature. You could potentially use an A, but you will loose the benefits of CDN. The other alternative for you at the moment is to use a CNAME for the www and redirect the non-www to the www. – Simone Carletti Jan 12 '14 at 17:22
@SimoneCarletti thanks for confirming that. I understand there may be a performance hit for DIY workarounds but I was curious how to implement it. I also asked a related question here. – Tom Brossman Jan 13 '14 at 20:10
I found freenom CNAME record support to – Zachary Nov 5 '14 at 8:38

According to

If you configure both an apex domain (e.g. and a matching www subdomain (e.g., GitHub's servers will automatically create redirects between the two.

Here is my setup that seems to work correctly:

  • in my DNS:

    • I've got a CNAME record for pointing to
    • I've got an A record for pointing to and
  • in my ghpages repo, my CNAME file contains

And this setup seems to work with Github's CDN.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.