DNS records for www site

I want to setup Cloudflare with DNS > Records for www.mysite.com.
My origin has IPv4 and IPv6 addresses.
I defined these records:
A mysite.com proxied
A www proxied
AAAA mysite.com proxied
AAAA www proxied

  1. Should I define only A records or AAAA records or both?
  2. When I enter in address bar: mysite.com it redirects to www.mysite.com. There is no redirection rule, so why it redirects?
  3. Should I use instead CNAME for mysite.com to redirect to www?
  4. Is there a better records definition for best performance?
  1. There’s no problem with having both. Cloudflare tries IPv6 first then IPv4.

  2. If you are sure there’s no redirection it could be your browser, an old permanent redirect that is cached in the browser, or a redirect on your origin. You can query with curl to try to find the reason (or give the domain name so we can check).

  3. A CNAME on the apex domain isn’t allowed by standards; Cloudflare will accept you entering one in the DNS but querying it will just return the target A/AAAA record (CNAME flattening) even if not proxied. Note that CNAMEs don’t redirect in themselves, they just eventually point at an IP address.

Where the apex and www are the same, most define the A/AAAA records for the apex domain and set www as a CNAME to it as a reminder of what is happening and to ensure that if edited, any changes affect both.

1 Like

Thanks,

  1. “There’s no problem with having both. Cloudflare tries IPv6 first then IPv4”
    What is the reason for using both?
  2. " Where the apex and www are the same, most define the A/AAAA records for the apex domain and set www as a CNAME to it as a reminder of what is happening and to ensure that if edited, any changes affect both."
    Does using CNAME for www instead of A/AAAA requires additional redirect or reduce performance?

I just use IPv6, but using both ensures you have adopted IPv6, with a fallback in case your IPv6 goes down for any reason (such as ISP problems, server problem, messing up the IPv6 firewall rules, etc).

A CNAME will slow down a DNS lookup by a small amount, but for most people not by an amount to worry about.

1 Like

Despite it being counterintuitive, Cloudflare actually does the opposite.

When both IPv4 and IPv6 connections are available, Cloudflare prefers IPv4.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.