5

Netlify custom domain docs is pretty huge and confusing. I didn't find answers to the simple questions. I have a static website I want to deploy on Netlify.

  • Should I use A record which is pointing to IP address of mywebsitename.netlify.com or CNAME which is pointing to mywebsitename.netlify.com?

  • If I chose A record; whether it is possible that Netlify change IP address after some time?

  • If I chose CNAME record; will it make redirection slower because it has one extra step?

In this A vs CNAME - firebase related answer it is said:

Use CNAME if you are using a multi-region CDN for a static site with google or a host like Netlify and you are not using their DNS servers for your domain. This will allow their servers to resolve users to the closest server in their region.

Ivan Aracki
  • 4,861
  • 11
  • 59
  • 73

1 Answers1

4

Unless your DNS provider supports CNAME flattening, ANAME or ALIAS records for root domains, we strongly recommend setting the www subdomain as your primary domain.

So simple answer, use a CNAME when using a custom domain on Netlify. The benefits will be greater than the extra millisecond it takes to redirect to the closer node on the CDN.

If you absolutely want the bare (root domain) name resolution for your site (example.com), then you will have to use an A record using the Netlify supplied IP address if you can't alias it with a method described in the quote above.

Note: Netlify has many sites using the IP address. There would be many reasons for them to try to make sure that IP address does not change. If that is a concern, use a subdomain for your site and use a CNAME record.

talves
  • 13,993
  • 5
  • 40
  • 63