Skip to main content

CNAME Setup

A common way to transfer domain traffic to Arvancloud CDN is to change domain NSs to NSs introduced in the user panel and then turn on the cloud icon.

$ORIGIN example.com.
example.com. 86400 IN NS a.ns.arvancdn.ir.
example.com. 86400 IN NS z.ns.arvancdn.ir.

In order to activate the CDN service on the domain, in addition to the possibility of changing the NSs of your domain, you can define a CNAME record for the subdomain that you intend to use in the Arvancloud CDN.

The CNAME setup feature allows you to proxy only the traffic of a specific subdomain through CDN pop sites without changing your domain's Authoritative DNS or Primary DNS. This feature will be very effective when you cannot change your Authoritative DNS or users of your service.

This feature solves the following common problems faced by SaaS providers to meet customer needs and issue SSL:

  • Branded Unencrypted Domains

    Branded domains without SSL lack the benefits of secure data transfer and the efficiency of SSL, making them vulnerable to hacking and attacks.

  • Non-Branded Encrypted Domains

    Domains that have an SSL certificate issued by the SaaS provider but do not have a dedicated domain name face SEO and branding issues.

  • Encrypted and Branded domains

    Providing encrypted and dedicated domains often means manually managing SSL certificates and their validity, which leads to time-consuming and expensive processes.

One of the advantages of Arvancloud CNAME Setup is the possibility of issuing SSL certificates for branded domains and users of SaaS services. Using this feature, your SaaS service customers can upgrade their security and performance without changing their subdomain name. For example, your user may want to use their app.test.com domain to point to your service.saas.com application registered on the Arvancloud CDN.

When you, as a SaaS Provider, use Arvancloud's CDN in the form of "CNAME Setup", you can manage the entire cycle of SSL certificate issuance and renewal.

This feature is currently only available in the Enterprise plan.

In this guide, we will discuss how to set up a CDN service using a CNAME on a subdomain.

First Step: Registering the Subdomain in the Arvancloud User Panel

In the first step, you need to register the subdomain that you want to use Arvancloud CDN in your user account. The domain registration guide will help you in this step.

After registering the domain, add the subdomain's A, AAAA, or CNAME record to the DNS records. For this, you can use the guide to add DNS records.

Second Step: Upgrade Traffic Transfer Type

From the "Dashboard" menu, in the "Traffic Transfer Type" section, click on the "Upgrade to CNAME " option.

On the page that opens, click on the "Convert Domain Type" option so that the NS records of the domain are deleted and a CNAME record is available to you.

After converting the traffic forwarding type, you will be provided with a unique value for the destination CNAME record of the subdomain.

You can also see more detailed information about your CNAME record from the DNS records section.

The default value is randomly generated by Arvancloud and provided to you. This value can be changed to your desired one.

To change traffic forwarding type using API, you can check out this sample request:

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

The important thing is that the desired value must refer to the Glue IPs of Arvancloud that were provided to you.

For example, pay attention to the following scenario:

  • We want to transfer the traffic of all domains of our organization to Arvancloud through the live.example.com record.

  • First, we must register each domain separately in Arvancloud and launch it through CNAME, and finally change their CNAME record to live.example.com.

  • Finally, we need to create an A record for the live.example.com address that points to Arvancloud's declared addresses.

Step 3: Register the CNAME Record in the Domain's Authoritative DNS

In the DNS provider of your root domain, delete the record associated with the subdomain that you registered in the Arvancloud panel, and then add a CNAME record with the value that was provided to you in the previous step.

blog.example.com.   0       IN      CNAME   802d64fa68594323a174bdea336ae4e5.cname.arvancdn.ir.

Fourth Step: Final Settings

When the CNAME record of the subdomain is published in all DNS servers, the status of the subdomain will change to "Active" in the Arvancloud user panel, and you can issue a free SSL certificate for this subdomain. This certificate is issued by Let's Encrypt and validated by the HTTP-01 challenge. To apply for a certificate, you can read Arvancloud's Certificate guide.