A and CNAME clarifications with subdomains

HI everyone:

I have a primary domain with several subdomains as I’m sure a lot of you have.

For clarification, let’s say my domain is “mydomain.com” and one subdomain of “blogs”.

In Cloudflare’s DNS, “mydomain” is an “A” record which points to the IP address; “blogs” is a “CNAME” record that points to “mydomain”.

Does this mean that any requests for “blogs.mydomain” have to go back to my server to have the subdomain resolved before Cloudflare serves them from the cache? Or does Cloudflare have the subdomain and its associated URLs cached as well and doesn’t have to go back to the server to resolve?

Or how does all that work?

It’s like a spider’s web to me because I’m not a networking person.

Thank you.

Not quite sure what you mean by that question, but it will never have to go to your server. A CNAME is purely DNS related and that will never reach your server. However, yes, with a CNAME you’d typically have two steps, first getting the hostname where the CNAME points to and then getting the IP address of that hostname.

In the case of Cloudflare though, records are typically proxied and such records are always automatically turned into A records which hold the respective addresses of the proxies. Furthermore you can even flatten non-proxied records if you are on a paid plan.

Thank you for your response. I was just wondering how it worked with subdomains because at some point I would think it does have to hit the server to at least pull the file requested from the subdomain to cache it.

And since the CNAME maps to the A record, I didn’t know how it understood it’s a subdomain until it hits the main server where the subdomain is configured.

So under the nuts and bolts, Cloudflare maps the subdomain url to a cached file so after it’s cached, it won’t have to retrieve the file again until the cached file expires because it can just look up the mapping?

For starters, these are not sub-domains but just regular host records/labels.

There’s not much of a difference between a CNAME and an A record, both eventually point to an IP address, with the CNAME having one additional step in-between.

Everything else - caching, URLs, files - is absolutely unrelated to that and DNS as a whole.

I’d recommend to check out support.cloudflare.com as that contains most of the information relevant to Cloudflare.

Plus, Domain Name System - Wikipedia is certainly a good idea too.

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