Skip to main content

Add a custom domain to a CDN resource

Last update:
  1. Register a domain.
  2. Create a CNAME record in DNS hosting.
  3. Add a custom domain in the Control Panel.
  4. Add a TLS(SSL) certificate to the CDN resource.
  5. Replace the domain in links on the website.

1. Register a domain

If you do not yet have a domain that you want to use as a custom one, register it. You can register a domain in Selectel.

If you already have a domain, proceed to step 2.

2. Create a CNAME record in DNS hosting

You can only use a subdomain of your main domain as a custom domain, for example cdn.example.com for example.com. You cannot use the main domain as a custom domain.

  1. Open the resource record editor for the domain:

    • if you have delegated the domain to Selectel, go to the Selectel Control Panel: in the top menu, click ProductsDNS Hosting → the Domain zones;
    • if the domain is managed in another DNS hosting service, open the control panel for that DNS hosting service.
  2. Create a resource record. Specify:

    • record type — CNAME;

    • record name — a subdomain such as cdn.example.com;

    • the value is a default domain in the form of *.selcdn.net . Specify the domain without the protocol, for example cdn.example.com. Each domain level can be up to 63 characters long. The total length of all levels must not exceed 253 characters.

      You can view the default domain in the control panel: in the top menu, click ProductsCDNCDN resources section → the domain will be specified in the resource line.

3. Add a custom domain in the Control Panel

  1. In the control panel, on the top menu, click Products and select CDN.

  2. In the CDN Resources section, open the resource page → General tab.

  3. In the Custom Domain block, click Add Custom Domain.

  4. Specify the custom domain for which you configured the record in step 2. If you have a Cyrillic domain, first convert it to Punycode. For example, for сдн.пример.рф you need to specify xn--d1ask.xn--e1afmkfd.xn--p1ai. You can use any Punycode converter — for example, at sweb.ru.

  5. Click Apply. While settings are being applied, the resource will have the PROCESSING status. You cannot apply other settings at this time. The settings will be applied once the resource enters the ACTIVE.

4. Add a TLS(SSL) certificate to the CDN resource

  1. In the control panel, click Products in the top menu and select CDN.

  2. Go to the CDN Resource Certificates section.

  3. If you want to issue a Let's Encrypt certificate:

    3.1. In the menu, select Issue Let's Encrypt certificate.

    3.2. Select the CDN resource for which you want to issue a certificate.

    3.3. Click Issue.

  4. If you want to upload a custom certificate:

    4.1. In the menu, select Upload custom certificate.

    4.2. Specify a certificate name. It will only be used in the control panel.

    4.3. Add the domain certificate. It must start with -----BEGIN CERTIFICATE----- and end with -----END CERTIFICATE-----.

    You can add a certificate chain (main domain certificate, intermediate, and root) — make sure they form a complete chain. The Issuer value of the main certificate must match the Subject value of the first intermediate certificate, the Issuer value of the first intermediate certificate — with the Subject value of the second intermediate, and so on.

    4.4. Add the private key. It must start with -----BEGIN PRIVATE KEY----- and end with -----END PRIVATE KEY-----.

    4.5. Click Upload.

  5. Go to the CDN Resources section.

  6. Open the CDN resource page → Certificates tab.

  7. Select the HTTPS delivery via CNAME checkbox.

  8. In the Certificate field, select the certificate you issued in step 3 or uploaded in step 4.

  9. Click Apply. While settings are being applied, the resource will be in PROCESSING status. You cannot apply other settings during this time. The settings will be applied once the resource switches to ACTIVE.

If you chose your own content origin when creating a CDN resource, replace the domain in the URLs of your website's static files with the custom domain of the form cdn.example.com, which you specified in step 3 when creating a CNAME record in step 2:

If your website is on a CMS, use a plugin to replace the URLs; otherwise, replace the URLs in the website code.