I recently migrated my personal blog from ericlim.me
to ericlim.dev
,
assuming it would be a simple domain swap. Everything had worked fine with the
.me
domain. I used Namecheap’s built-in redirect to point the root domain,
ericlim.me
, to the www
subdomain hosted on GitHub Pages, and it worked as
expected.
The Problem
But after switching to the .dev
TLD, visiting ericlim.dev
was hanging
without redirect or error page. I double-checked my DNS records and ran:
❯ dig ericlim.dev A +short
162.255.119.93
This confirmed the A record was still pointing to Namecheap’s redirect service, so I initially assumed it was just a DNS propagation issue.
It turns out the issue wasn’t GitHub, Namecheap, or propagation delays. The
issue was the HSTS preload enforcement on .dev
domains.
Since .dev
domains are on
Google’s HSTS preload list, modern browsers refuse
all HTTP connections to them, even the first attempt, and require HTTPS from the
outset. This broke my setup because Namecheap’s redirect service relies on
receiving an HTTP request before it can issue a redirect. But browsers will
never even make that request on .dev
. So the redirect fails silently and the
page appears stuck or unreachable.
The Solution
The fix was to stop relying on Namecheap’s redirect and instead point the DNS directly to GitHub Pages so it could handle HTTPS and redirection properly.
I didn’t need to change anything in my GitHub Pages settings or project setup. The only change I made was updating the DNS records in Namecheap.
Here’s what I did (based on GitHub’s apex domain instructions):
- Removed the redirect URL (
https://www.ericlim.dev
) - Added the following A records for the root domain
@
pointing to GitHub Pages’ IPs:185.199.108.153 185.199.109.153 185.199.110.153 185.199.111.153
This setup allowed GitHub to issue valid SSL certificates for both the root and
www
subdomains and automatically redirect https://ericlim.dev
→
https://www.ericlim.dev
over HTTPS as required.
Now both domains are fully functional and secure, and I have a much better
understanding of how HSTS, HTTPS, and custom domains interact on GitHub Pages.
If you’re running into strange issues with .dev
domains this might save you
hours of head-scratching.
TL;DR
If you use a domain from the HSTS preload list, you can’t rely on HTTP-based redirects. Instead, follow GitHub’s instructions for configuring an apex domain and point your A records directly to GitHub Pages.