Troubleshooting GitHub Pages NotServedByPagesError: Custom Domain Fixes

Setting up a custom domain for your GitHub Pages site should be a straightforward process, yet it's a common source of frustration for developers. One of the most frequently encountered hurdles is the NotServedByPagesError, which can prevent your site from loading correctly and, crucially, from using HTTPS. This community insight dives into a real-world scenario and provides comprehensive solutions to navigate this challenge, enhancing your overall software development management of web projects.

Developer troubleshooting a GitHub Pages custom domain error with DNS records
Developer troubleshooting a GitHub Pages custom domain error with DNS records

The NotServedByPagesError: A Common Roadblock

A GitHub user, boda-yoli-javi, recently encountered this exact issue while trying to set up nuestrocaosperfecto.es. Despite seemingly correct redirects, their site displayed the dreaded NotServedByPagesError, specifically stating: "Both rackslide.org and its alternate name are improperly configured Domain does not resolve to the GitHub Pages server. For more information, see documentation (NotServedByPagesError)." This error typically indicates a misconfiguration in how your domain's DNS records point to GitHub's servers, or an issue with your repository's GitHub Pages settings.

Successful GitHub Pages custom domain deployment with HTTPS enabled
Successful GitHub Pages custom domain deployment with HTTPS enabled

Key Solutions and Best Practices for Custom Domain Setup

While boda-yoli-javi eventually reported their issue resolved (likely due to DNS propagation or a minor fix), the discussion highlighted several critical steps for any developer facing this error. A senior developer, itxashancode, provided an excellent breakdown of potential causes and solutions, which are vital for effective software development management when deploying web applications:

1. Meticulous DNS Configuration

  • A Records for the Root Domain (Apex): For your root domain (e.g., yourdomain.com), you must configure A records to point to GitHub Pages' IP addresses. These are essential for the domain to resolve correctly to GitHub's servers. The current GitHub Pages IP addresses are:
    185.199.108.153
    185.199.109.153
    185.199.110.153
    185.199.111.153
  • CNAME Record for the www Subdomain: If you want your site accessible via www.yourdomain.com, create a CNAME record that points to your GitHub Pages username/organization page (e.g., username.github.io or orgname.github.io).
  • DNS Propagation Time: After making DNS changes, patience is key. DNS changes can take anywhere from a few minutes to 48 hours to propagate across the internet. An immediate check might still show errors even if everything is correctly configured.

2. Repository and GitHub Pages Settings

  • CNAME File in Repository: Ensure there is a CNAME file in the root of your repository (e.g., /CNAME). This file should contain only your custom domain (e.g., nuestrocaosperfecto.es or www.nuestrocaosperfecto.es).
  • GitHub Pages Source Configuration: Verify that your GitHub Pages source is correctly set in your repository settings (e.g., main branch, /docs folder, etc.).
  • Repository Visibility: For GitHub Pages to serve your site publicly, the repository itself must be public.

3. Domain Ownership and Availability

  • Unique Domain Use: Double-check that your custom domain is not already claimed or configured by another GitHub Pages user. Each custom domain can only be associated with one GitHub Pages site at a time.

Conclusion

The NotServedByPagesError on GitHub Pages with custom domains is almost always a configuration issue related to DNS records or repository settings. By methodically checking your A records, CNAME entries, the CNAME file in your repository, and your GitHub Pages source settings, you can resolve most issues. Remember to account for DNS propagation time. Mastering these technical details is a crucial aspect of effective software development management, ensuring your projects are not only built well but also deployed and accessible without unnecessary roadblocks.

Track, Analyze and Optimize Your Software DeveEx!

Effortlessly implement gamification, pre-generated performance reviews and retrospective, work quality analytics, alerts on top of your code repository activity

 Install GitHub App to Start
devActivity Screenshot