[SOLVED] fastpages with custom subdomain from AWS Route 53

Hi everyone, I’m new to fastpages and facing an issue with custom subdomain. I successfully published to <myusername>.github.io/<myrepo> with no problem. But I couldn’t make it work with my custom subdomain blog.myrootdomain.com.

The site for myrootdomain.com is a static site hosted in S3, the domain is in AWS Route 53. I’d like to direct blog.myrootdomain.com to the gh-pages fastpages site at <myusername>.github.io/<myrepo>. Here is what I did:

  • I added CNAME file in the fastpages repo with blog.myrootdomain.com
  • I edited _config.yml with url: "http://blog.myrootdomain.com" and baseurl: "".
  • I edited custom domain in the repo setting to be blog.myrootdomain.com
  • I went to Route 53 and added CNAME record with name blog.myrootdomain.com and value <myusername>.github.io/<myrepo>

At this point, when I type <myusername>.github.io/<myrepo> in the browser it switches to blog.myrootdomain.com automatically but it says the domain doesn’t exist. I’m new to this and confused what I’m doing wrong.

Before I had the S3 hosted static site, I used to point myrootdomain.com to my previous gh-pages site <myusername>.github.io, following instructions for apex domain in the documentation here, which is to use an A record with github IP addresses, and it worked. Now my situation changed, i.e. I have the apex domain pointing to an S3 site, and would like to point blog.myrootdomain.com to the fastpages project site.

Hope I have stated my problem clearly. I have no idea where the problem is, can anyone who knows DNS, Route 53 and gh-pages help me understand what’s going on and what I should do? Thanks in advance!

1 Like

I made it work with some trial and error. The answer that helped is a SO post here.

The culprit is in my last step, once I changed the CNAME in Route 53 to be just <myusername>.github.io without the repo name, it worked. It turns out that <myusername>.github.io is equivalent to the IP addresses:

for github pages for A record approach of the apex domain example in the documentation. That answers the confusion I had before.

It took some time to take effect, and Chrome somehow caches the old “domain doesn’t exist” result in the same tab, try open a new tab to test.

Just leave it here for newbies like me who face the same problem in the future.

I found this information helpful. Another one I found helpful was this page from github: https://docs.github.com/en/github/working-with-github-pages/managing-a-custom-domain-for-your-github-pages-site
There were a few important pieces to get everything working for me. The first was setting up a CNAME file with the name of the web location I wanted to be used. Next, I had to set up a cname dns record that pointed from that web location to {my gihub name}.github.io

1 Like