DEV Community

Cover image for Adding Subdomain to Cloudflare – Understanding Management & Support System
Danya Ayaz
Danya Ayaz

Posted on

Adding Subdomain to Cloudflare – Understanding Management & Support System

Brief Intro to Cloudflare

Cloudflare is a U.S-based website security and infrastructure company to provide services such as content delivery network, DDoS migration, internet security and distributed domain name server. All these services bridge a typical website visitor and hosting provider at Cloudflare thereby acting as a reverse proxy.
Back in 2014, the rise in cybercrimes let Cloudflare to introduce Project Galileo as a countermeasure against defenceless online targets like journalists, activists, artists and various human rights groups. Primary aim of Project Galileo was to provide all these groups free website protection services. Last year, that is in 2019, the company claimed that the number of project participants reached around 600 different users and organisations.

Understanding Subdomain Support

Cloudflare Subdomain Support is for convenient management of dedicated services such as security and performance for subdomains as well as extracting additional benefits. It must be noted that Cloudflare Subdomain Support is available only to enterprise-grade customers and enabled as default for these users.
All that said, subdomain is simply referred to as a subsection of the parent OR primary domain. Take for instance “abc.com” is a parent domain whereas “service.abc.com” is a subdomain however, “www.abc.com” itself is technically considered a subdomain as well.

A Glimpse into Cloudflare CDN Management

A list of all domain names associated to your account (primary, parked and addon domains) are listed on the cPanel tool page of Cloudflare. There’ll be a manage button for the activated Cloudflare CDN services, giving you access to the selected domain’s management options.
Right on the first tab, you’ll come across subdomains of the website’s hosting account and details as to whether Cloudflare CDN has been activated for them or not. To activate the CDN services for any of the subdomains, simply hit the ‘Activate’ button right next to it.

Technical Terminologies

Before we proceed with the guide, it’s important to understand a few technical terms used throughout the document.
Root Domain: This is the domain that has been purchased from a domain registrar. For instance, “xyz.com”
Child Subdomain: A subdomain level directly below the root domain like “abc.xyz.com”
Parent Domain: Domain or Subdomain level that’s directly above the child subdomain

Advantages

There are several benefits of subdomain support, such as:
Through Subdomain Support, your organisation’s designated teams can manage Cloudflare setting for a particular subdomain whereas root or parent domain control is looked upon by the central IT team
Take for instance a centralised IT team of xyz.com which allocate child subdomains like abc.xyz.com to various departments whereas maintaining control of the primary/parent domain
abc.xyz.com require different Cloudflare settings than that of blog.xyz.com

Basic Requirements

There’re various requirements to Subdomain Support worth knowing about things like:

In the situation when parent domain enables the DNSSEC while the child’s subdomain disables it, DNS resolution of the child subdomain bursts
Upon activating parent domain over Cloudflare, child subdomain migration from a Cloudflare account to another needs reverting back the child subdomain to the parent
The SSL certificate of the parent domain can be viewed by users/visitors of the child subdomain only if parent’s certificate clearly lists child subdomain and created following issuance/activation of the child’s SSL certificate
Just in case both parent and child subdomain are on Cloudflare, you need to match the subdomain setup type (Complete or CNAME) to the parent’s setup type
The Cloudflare Edge Side Code (ESC) against a parent domain is inapplicable automatically to the child subdomain unless changed to the ESC
If a child subdomain utilises a resolve override against a parent domain in a distinct Cloudflare account, CNAME sharing must be activated.

Alt Text

Adding Child Subdomain(s) to Cloudflare

When substituted from the parent domain, the child subdomain experiences downtime for a couple of minutes. Simply add subdomains either onFull or CNAME setup. In an ideal scenario, child domain setup has to imitate parent domain’s setup. You need to ensure that configuration of the Cloudflare for subdomain has moved from the parent to the child subdomain before activating it at Cloudflare.

Adding Child Subdomains by CNAME Setups

If you wish to add child subdomains following the same manner, check out the guide line on how to configure a CNAME setup, presented by Digital Gravity a creative digital agency.

Adding Child Subdomains through Full Setups

To add a child subdomain against a full setup, refer to yet another guide on how to change domain name servers to Cloudflare presented by Digital Express. Just in case a parent domain’s already geared for a complete/full setup, all you need to do is adding NS records to the Cloudflare DNS app for the parent domain.

Important: Adding the DNS records to the Cloudflare DNS app for the child domain must be done before creating the NS records in the parent domain. Once it has been created and the child subdomain has been activated on Cloudflare, you would need to remove any DNS records other than the NS, referring to the child subdomain from the parent domain.

Adding Child Subdomains – Best Practices

On adding the child subdomain to the Cloudflare, the parent domain imminently loses configuration control over the subdomain. You would need to move the Page Rule configuration from the parent to the child subdomain prior to activation along with NS record setting or TXT records.

Subdomain Migration to a New Cloudflare Account

As mentioned previously, a child subdomain experiences downtime for a few minutes when substituted from the parent domain. To move a subdomain for a complete setup from a Cloudflare account to another, here’s what you need to do:

Add subdomain to the new Cloudflare account while deleting the CNAME or A record from the old
Create subdomain’s CNAME or A record against the new account of Cloudflare

Update the NS records for the subdomain referring to the fresh/new nameservers associated to the new account

Adding A Cloudflare Subdomain

Creating the CNAME Record
Using your Cloudflare account, click on the domain you wish to connect.
Select "DNS” from the top menu
Click "Add record" right beneath the DNS records and at the top
Select CNAME from the dropdown option(s)
Enter "Subdomain" as the Name* (you would put your subdomain here).
Enter Target.
Click "Save"

Author Bio

Danya Ayaz is specializing in Digital Marketer & lead gen Specialist. She is obsessed with Marketing and experimenting with new things in life. Combining the unthinkable is also sometimes reflected in her marketing efforts.

Top comments (0)