Notes on hosting sites on Netlify.

Using external DNS (Cloudflare)

  • From Netlify:
    • “If you’re using external DNS, we strongly recommend setting the www subdomain (or another subdomain) as your primary domain. If you want to set an apex domain as your primary domain, we recommend using Netlify DNS. Our blog post How to Set Up Netlify DNS has more details on these recommendations.”
    • “If you set the www subdomain as your primary domain, Netlify will automatically redirect the apex domain to the www subdomain.”
  1. Set primary domain to “www”: Go to Netlify → Sites → (the site you want to change) → Custom Domains → www.yoursite.com → Set as primary domain.

  2. Ensure that there are 2 entries in the domains list for the site in Netlify - one apex (naked) domain like example.com and one with the www prefix like www.example.com

In Cloudflare:

  1. Add the domain you want to proxy from Cloudflare.

  2. Add a CNAME record, host field @ and value apex-loadbalancer.netlify.com

  3. Add a CNAME record, host field www and value your-site.netlify.app