How to Use CNAME Setup on VergeCloud for Adding a Subdomain

Using CNAME Setup on VergeCloud: Add a Subdomain to Your Website

VergeCloud CNAME Setup

Introduction

The CNAME setup feature in VergeCloud allows you to route traffic for a specific subdomain through VergeCloud’s CDN while keeping the existing Authoritative DNS settings. By using this feature, you gain enhanced control over subdomain traffic without requiring full domain DNS changes. This setup is especially useful when direct DNS changes are not possible, such as when serving applications for users of SaaS services.

Glossary

  • CNAME Record: A DNS record used to alias one domain name to another, helping in redirecting traffic without changing IP addresses directly.
  • CDN: Content Delivery Network, a system of distributed servers that deliver content to a user based on geographic location, boosting speed and reliability. learn more
  • SSL: Secure Sockets Layer, a protocol for encrypting information over the internet, ensuring secure data transfer. learn more

Real Usage Scenarios

The CNAME setup on VergeCloud is particularly beneficial for SaaS providers managing customer domains. Here are common scenarios:

  • Branded Unencrypted Domains: Custom-branded domains without SSL lack secure data transfer, making them susceptible to data breaches.
  • Non-Branded Encrypted Domains: Domains using a shared SSL certificate from the SaaS provider may encounter SEO and branding challenges.
  • Encrypted and Branded Domains: Providing dedicated SSL for custom-branded domains can be complex and expensive to manage manually. The CNAME setup on VergeCloud simplifies this process, offering SaaS customers enhanced security without the need to change their primary domain settings.

Step-by-Step Setup Guide for VergeCloud CNAME Setup

Step 1: Registering the Subdomain in VergeCloud User Panel

First, log in to your VergeCloud account and register the subdomain where you want to apply CDN services.

After registering, add the subdomain's A, AAAA, or CNAME record in the DNS records.

Registering Subdomain in VergeCloud

Step 2: Upgrade Traffic Transfer Type

In the VergeCloud Dashboard, navigate to the Traffic Transfer Type section and select "Upgrade to CNAME".

Upgrading Traffic Transfer Type

On the next screen, select Convert Domain Type. This will replace existing NS records with a CNAME record specific to your subdomain’s destination address.

Converting Domain Type

After conversion, VergeCloud provides a unique CNAME destination record value for your subdomain. This value can be modified if necessary.

API Example: Changing Traffic Forwarding Type

curl --location --request POST 'https://api.vergecloud.com/cdn/4.0/domains/example.com/cname-setup/convert' \
--header 'authority: api.vergecloud.com' \
--header 'accept: application/json, text/plain, */*' \
--header 'authorization: API KEY 1 2 3 4' \
--header 'cache-control: no-cache'

Example Scenario

If you want all organizational domains to route traffic through VergeCloud, start by registering each domain in VergeCloud, activate them through CNAME, and then update their CNAME records to direct traffic to the primary domain, such as live.example.com. Next, create an A record that directs live.example.com to VergeCloud’s IPs.

Step 3: Registering the CNAME Record in Authoritative DNS

Within the DNS provider settings for your primary domain, delete any previous records associated with the subdomain. Then, create a new CNAME record using the value from VergeCloud’s setup:

blog.example.com.   0       IN      CNAME   802d64fa68594323a174bdea336ae4e5.cname.vergecloud.com.
Adding CNAME Record in DNS Provider

Step 4: Final Settings

Once the CNAME record is propagated across DNS servers, the subdomain’s status will change to "Active" within the VergeCloud panel. You can then issue an SSL certificate for the subdomain, provided by Let's Encrypt. The certificate is validated using HTTP-01 challenge. Follow VergeCloud’s SSL certificate guide for more details.

Testing and Validation

To ensure the CNAME setup is functioning correctly, follow these steps:

  1. DNS Validation: Use dig blog.example.com to check if the CNAME resolves to the specified VergeCloud CDN address.
  2. SSL Certificate Check: Verify SSL installation with curl -v https://blog.example.com to confirm secure connections.
  3. Browser Test: Visit https://blog.example.com in a web browser to confirm that traffic is routed correctly through VergeCloud's CDN.