If you have a website on GitHub Pages that sits on a root domain (a domain that isn’t a subdomain), you’re in trouble.
Have you ever noticed how your site loads slowly sometimes? It’s not your connection.
GitHub Pages with a custom domain is unbelievably slow.
Visitors to this site’s index page have an average page load time of 3.5 seconds. 70% of those are here for the first time. 3.5 ÷ 70% = 5. So first time visitors have an average page load time of 5 seconds. 1
This website is now off of GitHub Pages and loads in 700 milliseconds on a first visit, gaining over 4 seconds.
What do you lose when you add 4 seconds of delay on a first time visit?
Of the visitors that visit your GitHub Pages site for the first time, 35% more of them won’t bother to open another page. Your bounce rate is doubled.
Anselm Hannemann has a good rundown of the problem, including a note from GitHub support. When a domain has a DNS A record (pointing to GitHub Pages’ IP), GitHub’s DDoS mitigation technology has no alternative than to make a long redirect
What I’ve noticed is that sometimes it’s not just a big long redirect but multiple 302 redirects. This behavior isn’t documented anywhere it seems.
5 seconds seems big. When I notice a slow GitHub Pages website the wait seems to be more around 3 seconds, and that’s what I usually see in Chrome’s Network panel. The thing is, InstantClick’s visitors are spread around the world, my guess is this is what tilt the balance. 2
The short solution is, instead of using
If you want to keep your clean www-less domain, you’ll have to move off of GitHub Pages, and/or use CloudFlare who can have a CNAME record on the root domain. The latter has the advantage of making your website super-fast across the globe with its edge caching feature.
Updates: 1. Thanks to Hacker News’s dknecht who pointed out that CloudFlare can have a CNAME record on the root domain, which should solve GitHub Pages’ performance issues. 2. I previously recommended moving to Neocities, but they currently have similar problems. :(
This website uses a Digital Ocean VPS 4 with CloudFlare.
By the way, you should defitively check out InstantClick if you care about web performance.