Skip to main content

CNAME Setup

A common way to move a domain's traffic to the Arvancloud CDN is to change the domain's NSs to the NSs shown in the Arvancloud 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.

To activate the CDN, besides changing your domain's NSs, you can define a CNAME record for the subdomain you want to use the Arvancloud CDN.

CNAME Setup lets you proxy only a specific subdomain's traffic through CDN PoP sites without changing your domain's authoritative or primary DNS. This is very useful when you can't change your own authoritative DNS or that of your service's users.

This feature solves the following common problems that SaaS providers face in meeting customer needs and issuing SSL certificates:

  • Unencrypted custom domains

    Custom domains without SSL lack the benefits of secure data transfer and SSL performance, which makes them vulnerable to intrusion and attacks.

  • Encrypted provider domains

    Domains with an SSL certificate issued by the SaaS provider but without a custom domain name face SEO and branding problems.

  • Encrypted custom domains

    Offering encrypted custom domains often means managing SSL certificates and their validity manually, which leads to long, time-consuming processes and costs.

One of the benefits of Arvancloud CNAME Setup is the ability to issue SSL certificates for custom domains and users of SaaS services. With this feature, your SaaS customers can improve the security and performance of their subdomain without changing its name. For example, your user may want to use their app.test.com domain to point to your application, service.saas.com, which is registered on the Arvancloud CDN.

When you, as a SaaS provider, use the Arvancloud CDN with CNAME Setup, you can manage the entire SSL certificate issuance and renewal cycle.

This feature is currently available on Growth plans and above.

This guide explains how to set up the CDN on a subdomain using CNAME.

Step 1: Add the Subdomain in the Arvancloud Panel​

First, add the subdomain you want to use the Arvancloud CDN to your account. The domain registration guide helps you with this step.

After adding the domain, add the subdomain's A, AAAA, or CNAME record to the DNS records. You can use the guide to adding DNS records for this.

Step 2: Upgrade the Traffic Transfer Type​

In the Dashboard menu, under Traffic Transfer Type, click Upgrade to CNAME Setup.

On the page that opens, click Convert Domain Type so the domain's NS records are removed and a CNAME record is provided to you.

After the traffic transfer type is converted, you receive a unique value for the target of the subdomain's CNAME record, which you can also see in the domain's dashboard.

You can also see more detailed information about your CNAME record in DNS Records.

The default value is randomly generated by Arvancloud and provided to you. You can change this value to a subdomain of your choice.

To change the traffic transfer type via API, you can use the following 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'

Note that the custom value must point to the Arvancloud Glue IPs provided to you.

For example, consider the following scenario:

  • We want to move the traffic of all our organization's domains to Arvancloud through the live.example.com record.
  • First, we must add each domain to Arvancloud separately and set it up with CNAME, and finally change their CNAME records to live.example.com.
  • Finally, we must create an A record for live.example.com that points to the addresses provided by Arvancloud.

Step 3: Add the CNAME Record to the Domain's Authoritative DNS​

At your root domain's DNS provider, delete the record for the subdomain you added in the Arvancloud panel, and then add a CNAME record with the value you received in the previous step.

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

Step 4: Final Settings​

When the subdomain's CNAME record is published on all DNS servers, the subdomain's status in the Arvancloud panel changes to Active, and you can issue the free Arvancloud SSL certificate for this subdomain. This certificate is issued by Let's Encrypt and validated with the HTTP-01 challenge. To request a certificate, see the Arvancloud certificate guide.