GitHub Pages: setting up custom domain
Asked Answered
F

3

13

I've got an organization page set up and running in GitHub and things seem to be working...but I'm a little confused. I'd like to actually understand the process since the GitHub Help article refers to taking advantage of their CDN and DoS services, so bear with me.

Step 1: Created CNAME file in repo with domain 'example.com'

Step 2: Grabbed IP from dig example.github.io +nostats +nocomments +nocmd

Step 3: Entered IP from Step 2 into the 'A' record (see image below)

I decided to stop here and see where it got me, and to my surprise it seems to have done the trick. The example.github.io domain correctly redirects to the example.com domain and displays the content from the repo.

However I was informed that after the DNS props, you can dig example.com and see the CNAME record pointing to example.github.io. I do not see this, and I dislike thinking that I didn't set things up correctly. Any thoughts/comments/tips welcome, thanks!

GoDaddy Domain DNS Zone File

Flagg answered 16/4, 2014 at 1:29 Comment(0)
I
26

In order to take advantage of the CDN and DoS services provided by GitHub Pages, you'll need to set up a Subdomain (eg www.example.com or blog.example.com) instead of an Apex domain (example.com).

From the GitHub Help page you referenced:

If you are using an apex domain (example.com) instead of a subdomain (www.example.com) and your DNS provider does not support ALIAS records, then your only option is to use A records for your DNS. This will not give you the benefit of our Content Delivery Network.

Here's a setup (looks like you're using GoDaddy for DNS) that would work to get your Organization Pages working as desired:

DNS zone file on GoDaddy, set up for GitHub Pages

This is actually for a Project Page within an Organization, but for either one, you'll set the CNAME record for www to organization.github.io, not something like organization.github.io/project. Don't change the A record for @ (mine is the default from GoDaddy).

If you want to get your Apex domain (example.com) to redirect to the new subdomain (www.example.com), then you can point your Apex to your subdomain with Domain Forwarding like this:

Domain Forwarding on GoDaddy

With that setup, you'll get to take advantage of GitHub's CDN, which you may notice is provided through fastly. Here's how my domain looks to dig:

Domain info for www.jekyllblog.com

Inconsolable answered 16/4, 2014 at 17:20 Comment(4)
Beautiful answer, thanks for all the detail! Does your method mean the domain will require the www before it to take advantage of the CDN/DoS services? Could I set it up to forward www.example.com to example.com?Flagg
Sorry, but after re-reading your answer a couple of times it appears that the port-forwarding is only necessary if you specifically want the domain to display as www.example.com. Correct?Flagg
Yes, the domain will require the www (or any other subdomain) to take advantage of CDN/DoS. Domain Name Forwarding allows you to send visitors who type in example.com to end up at www.example.com. Without that setup, visitors will see your site only at www.example.com and will see nothing at example.com. If you want to use DNSimple, you can do this the other way around (point www.example.com to example.com), but I don't think GoDaddy supports it. More on that here: webmasters.stackexchange.com/questions/56826/…Inconsolable
Just checked on GoDaddy, sounds like they do not support the non-standard ALIAS records like DNSimple does, per this discussion: serverfault.com/questions/486406/…Inconsolable
M
5

It is also possible to use a CNAME record for an APEX domain using the free DNS service provided by CloudFlare in which case you can also use your domain without the www (or any other subdomain) and still benefit from CDN & DoS.

I've written a step-by-step guide here: Speed up your GitHub Pages website with CloudFlare

PS: Apparently using ALIAS records is a bad idea... click here to see why.

Mackle answered 21/6, 2014 at 8:41 Comment(0)
C
0

DNS records are publicly available. There's no way of masking them in this instance. From the way you describe it, you have done everything right. There is nothing that makes me thing you set this up incorrectly.

Craig answered 16/4, 2014 at 1:36 Comment(2)
Who said anything about masking?Aromatic
Thanks for your answer @Nilnoc. I was just doing some reading and it seems that maybe the pre-existing 'www' record that points to '@' is referencing the '@' record were I made my IP change. Does that make sense? Kind of seems to, just a little confusing.Flagg

© 2022 - 2024 — McMap. All rights reserved.