Adding Subdomain to Cloudflare – Understanding Management & Support System 
Tags: cloudflare, webdev, javascript, management
Published: 2020-01-23 06:47:57

<strong>Brief Intro to Cloudflare<strong>

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.

<strong>Understanding Subdomain Support<strong>

Cloudflare Subdomain Support is for convenient management of dedicated services such as security and performance for subdomains as well as extracting <a href="https://support.cloudflare.com/hc/en-us/articles/360026440252#h_fd97794b-8709-467e-bfe6-2a9788d42bd9">additional benefits</a>. 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.


<strong>A Glimpse into Cloudflare CDN Management<strong>

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.


<strong>Technical Terminologies<strong>

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



<strong>Basic Requirements<strong>


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 <a href="https://support.cloudflare.com/hc/en-us/articles/206190798">resolve override</a> against a parent domain in a distinct Cloudflare account, <a href="https://support.cloudflare.com/hc/en-us/articles/360029779472#error1014">CNAME sharing</a> must be activated. 

<a href="https://www.digitalgravity.ae/blog/wp-content/uploads/2020/01/cloud-flare-2-1024x670.jpg" class="article-body-image-wrapper"><img src="https://www.digitalgravity.ae/blog/wp-content/uploads/2020/01/cloud-flare-2-1024x670.jpg" alt="Alt Text" loading="lazy"></a>

<strong>Adding Child Subdomain(s) to Cloudflare<strong>

When substituted from the parent domain, the child subdomain experiences downtime for a couple of minutes. Simply add subdomains either on<a href="https://support.cloudflare.com/hc/en-us/articles/360026440252#h_4cd940e3-e84d-4848-9cdb-2f592638ffaf">Full</a> 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.

<strong>Adding Child Subdomains by CNAME Setups<strong>

If you wish to add child subdomains following the same manner, check out the guide line on how to <a href="https://support.cloudflare.com/hc/en-us/articles/360020615111">configure a CNAME setup</a>, presented by <a href="https://digitalgravity.ae/">Digital Gravity</a> a creative digital agency.

<strong>Adding Child Subdomains through Full Setups<strong>

To add a child subdomain against a full setup, refer to yet another <a href="https://support.cloudflare.com/hc/en-us/articles/205195708">guide on how to change domain name servers to Cloudflare</a> presented by <a href="https://digitalexpress.agency/">Digital Express</a>. 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.

<strong>Adding Child Subdomains – Best Practices<strong>

On adding the child subdomain to the Cloudflare, the parent domain imminently loses configuration control over the subdomain. You would need to move the                                                                                                        <a href="https://support.cloudflare.com/hc/en-us/articles/218411427">Page Rule</a> configuration from the parent to the child subdomain prior to activation along with NS record setting or TXT records.


<strong>Subdomain Migration to a New Cloudflare Account<strong>

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

<strong>Adding A Cloudflare Subdomain<strong>

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"


<strong>Author Bio<strong>

<a href="https://www.linkedin.com/in/danya-a/">Danya Ayaz</a> 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.