Updated on 2026-08-04 GMT+08:00

Getting Started with CDN

Operation Process

Procedure

Description

Preparations

Register a HUAWEI ID and enable CDN.

Step 1: Add a Domain Name

Add a domain name to CDN for acceleration and configure an origin server for the domain name.

Step 2: (Optional) Quickly Configure the Domain Name

After adding the domain name for acceleration, configure cache rules, smart compression, and secure acceleration to improve the cache hit ratio, optimize the acceleration effect, and enhance security.

Step 3: Configure a CNAME Record

After you add a domain name, the system automatically assigns a CNAME to it. The CNAME cannot be accessed directly. You must configure a CNAME record that points your domain name to the assigned CNAME address. This ensures that requests to your domain name are redirected to CDN PoPs for acceleration.

Step 4: Verify the CNAME Record

The time it takes for the CNAME record to take effect depends on the DNS provider. You can check whether the CNAME record has taken effect by yourself.

Preparations

  1. Register a HUAWEI ID and specify a payment method.
  2. Enable CDN.
  3. Prepare a domain name for acceleration and an origin server (service server) based on the domain name admission conditions, content moderation requirements, and domain name description in the Notes and Constraints.

Step 1: Add a Domain Name

  1. Add your domain name to CDN for acceleration. In this example, the domain name www.example.com is used.
    1. Log in to the CDN console.
    2. In the navigation pane, choose Domains.
    3. On the Domains page, click Add Domain Names and specify domain parameters.
      Figure 1 Basic settings
      Table 1 Parameters

      Parameter

      Item

      Description

      Domain Names

      -

      • A domain name can contain up to 200 characters, including letters, digits, hyphens (-), periods (.), and asterisks (*). It can start with a letter, digit, or asterisk. An asterisk, if any, must be the first character.
      • Each label of a domain name (for example, *** in ***.***.com) can contain up to 63 characters.
      • You can add up to 100 domain names under each account.
      • CDN does not allow access from websites containing illicit content. For details, see "Content moderation" in Restrictions. The existing domain names connected to CDN are reviewed regularly. If a domain name involves any violations, CDN acceleration will be suspended for the domain name and other domain names in your account.
      • If a domain name has been in the Disabled or Rejected state for more than 120 days, CDN starts the domain name deletion process and deletes the domain name records after confirmation. If CDN acceleration is required for the domain name, add the domain name again.
      • If a domain name has not been accessed for more than 180 days, CDN starts the domain name suspension process and disables CDN acceleration for the domain name after confirmation.
      • An acceleration domain name must be unique.
      • You can add a domain name including a wildcard (*). For example, if you add *.test.com to CDN as an acceleration domain name and have it resolved to the CNAME provided by CDN, all of the level-2 domain names under *.test.com, such as a.test.com, will enjoy CDN acceleration by default. However, level-3 domain names (such as b.a.test.com) would not.
        1. If you add a wildcard domain name to a particular account, you cannot add any of the level-2 domain names under that domain name to other accounts.
        2. You will be billed for the acceleration service provided to all of the level-2 domain names under a wildcard domain name. If there are multiple level-2 domain names, billing will be based on the traffic generated by the wildcard domain name, not on each of the level-2 domain names.

      Enterprise Project

      -

      This parameter is only available if Huawei Cloud Enterprise Project Management Service is enabled. For details, see Enterprise Management User Guide.

      You cannot select disabled enterprise projects.

      Service Area

      Global

      CDN schedules all user requests to the optimal PoP nearby. Apply for a license for the domain name from the Ministry of Industry and Information Technology (MIIT). For details, see ICP License Service.

      Chinese mainland

      CDN schedules all user requests to PoPs in the Chinese mainland. Apply for a license for the domain name from the MIIT. For details, see ICP License Service.

      Outside Chinese mainland

      CDN schedules all user requests to PoPs outside the Chinese mainland. You do not need to apply for a license for the domain name from the MIIT.

      Service Type

      Website

      CDN is perfect for web portals, e-commerce platforms, news apps, and user generated content (UGC)–focused apps. The cache format includes but is not limited to .zip, .exe, .wmv, .gif, .png, .bmp, .wma, .rar, .jpeg, and .jpg.

      File download

      CDN is useful for download clients, game clients, app stores, and websites that provide download services based on HTTP or HTTPS.

      On-demand services

      CDN accelerates delivery of on-demand services, such as online education, video sharing, music or video on demand, and other audiovisual content.

      Whole site

      CDN is a good option for websites that consist of both dynamic and static content and for sites with abundant ASP, JSP, or PHP requests.

      CAUTION:
      • WSA is an independent cloud service and is billed separately. It shares the same console with CDN. You need to enable WSA before adding domain names for whole site acceleration. For details about how to enable WSA, see Enabling WSA.
      • When Service Type is set to Whole site, the origin server type cannot be set to OBS bucket.

      Tag (Optional)

      -

      Tags help you identify your cloud resources. When you have many cloud resources of the same type, you can use tags to classify them by dimension (for example, usage, owner, or environment). You can then quickly search for and select specific cloud resources by tag.

      Tag Key: Enter 1 to 128 characters. Only letters, digits, spaces, and the special characters _, ., :, =, +, -, and @ are allowed. It cannot start or end with a space, or start with _sys_.

      Tag Value: Enter 1 to 255 characters. Only letters, digits, spaces, and the special characters _, ., :, =, +, -, @, and / are allowed. It cannot start or end with a space.

      Remarks (Optional)

      -

      You can add remarks to an acceleration domain name for easier identification and management.

      • The remarks cannot exceed 10,000 characters.
      • Special characters /, <, and > are not supported.
  2. Verify domain name ownership. When you add a domain name to CDN for the first time, verify your ownership of the domain name to avoid unauthorized or malicious use. The following uses file verification as an example. For DNS resolution verification, see Verifying Domain Name Ownership.
    1. When adding a domain name to CDN, verify the ownership of the domain name when you encounter the scenario shown in the following figure.
      Figure 2 Verifying domain name ownership
    2. Click View Methods and click the File Upload tab. Do not close the verification page before the verification is complete.
    3. Click verification.html to download the file.
    4. Upload the file to the root directory of your domain server.
    5. Click Verify to verify the ownership of the domain name.

      Huawei Cloud CDN will access http://example.com/verification.html to obtain the verification file. If the system verifies that the obtained file is correct, the verification is successful. Ensure that the verification file is accessible.

  3. In the Origin Server Settings area, set Origin Pull Method for CDN PoPs. The following options are supported:
    • HTTP: CDN uses HTTP for origin pull.
    • HTTPS: CDN uses HTTPS for origin pull. (Ensure that the origin server supports HTTPS access.)
    • Same as user: The origin protocol is the same as the client access protocol. For example, if a client accesses CDN using HTTP, CDN also uses HTTP for origin pull.
  4. Add an origin server. An origin server is a service server. When a client accesses a resource that is not cached on CDN PoPs, CDN requests the resource from the origin server and returns the resource to the client.
    1. In the Origin Server Settings area, click Add Origin Server to add an origin server for the domain name.
      Figure 3 Adding an origin server
      Table 2 Parameters

      Parameter

      Description

      Type

      Origin server IP address

      • CDN PoPs access the IP address directly to pull origin content.
      • IPv4 is supported, but IPv6 is not supported.
      • If multiple IP addresses are configured, CDN uses load balancing to pull content from the origin server.

      Origin server domain name

      • Start with a letter or digit. Use only letters, digits, hyphens (-), and periods (.). Enter up to 255 characters.
      • Each label of a domain name (for example, *** in ***.***.com) can contain up to 63 characters.
      • An origin domain cannot be the same as an acceleration domain name.
      • You can also enter the domain name of an object storage bucket. Pay attention to the following points when selecting this option:
        1. You cannot use private object storage buckets as origin servers when you set Type to Domain name.
        2. If you use an object storage bucket as your origin server, the object storage service will charge the origin pull traffic based on its billing standards.
        3. When back-to-source by mirroring is configured on OBS and range requests are enabled on CDN, if the mirror origin server does not comply with the RFC Range Requests standard, the response to range requests is not 206. As a result, CDN fails to pull content.
        4. If you use an OBS bucket created after January 1, 2022 as the origin server and want to enable online preview, log in to the CDN console, choose Domains in the navigation pane, click the target domain name, click the Advanced Settings tab, click Edit next to HTTP Headers, and set Content-Disposition to inline. For details, see How Do I Preview OBS Objects in My Web Browser?

      OBS bucket domain name

      Select an OBS bucket domain name under your account or customize one. OBS charges the CDN origin pull traffic based on the billing standard for outgoing Internet traffic. If you set a bucket of OBS 3.0 or a later version as the origin server, you can purchase OBS pull traffic packages to deduct origin pull traffic. For details, see OBS Billing for CDN Acceleration.

      Important notes:

      1. If your OBS private bucket is unsuitable as an origin for your domain name, do not set the private bucket as the origin server.
      2. If you enter a domain name of an OBS bucket, the entered domain name must end with .myhuaweicloud.com or .myhuaweicloud.cn.
      3. If you set an OBS private bucket as the origin server and want to filter user requests, enable OBS authorization and OBS Pull Authentication. Otherwise, origin pull will fail.
      4. To use a custom OBS private bucket as the origin server, configure a policy for the private bucket. For details, see Configuring a Policy for a Custom OBS Private Bucket.
      5. If you have enabled static website hosting for your OBS bucket, select the Static website hosting checkbox when adding a domain name. In this way, a full list of files in the bucket will not be displayed when users access the bucket.
      6. When back-to-source by mirroring is configured on OBS and range requests are enabled on CDN, if the mirror origin server does not comply with the RFC Range Requests standard, the response to range requests is not 206. As a result, CDN fails to pull content. In this case, submit a service ticket.
      7. When Service Type is set to Whole site, the origin server type cannot be set to OBS bucket.
      8. If the origin server is an OBS private bucket, when a client requests the homepage of the acceleration domain name and origin pull is triggered, origin pull can succeed only when the request method is GET or HEAD. For other request methods, CDN blocks the request and returns status code 403.
      NOTE:

      If you use an OBS bucket created after January 1, 2022 as the origin server and want to enable online preview, log in to the CDN console, choose Domains in the navigation pane, click the target domain name, click the Advanced Settings tab, click Edit next to HTTP Headers, and set Content-Disposition to inline. For details, see How Do I Preview OBS Objects in My Web Browser?

      Address

      Address accessed by CDN PoPs during origin pull.

      • If the origin server type is IP address, you can enter multiple IP addresses and separate them with commas (,).
        • Each IP address is an origin server. A domain name can have up to 50 origin servers. The number of IP addresses you can enter cannot exceed the total number of available origin servers of the domain name.

      Host Header

      A host is specified in the HTTP request header. It is the domain name of the site accessed by CDN PoPs when CDN pulls content from the origin server. CDN obtains resources from the corresponding site based on the host details during origin pull.

      After a domain name is added, the default host will be the domain name. Change the host in a timely fashion if either of the following conditions is met:
      • If you set Type to Domain name and enter the domain name of an object storage bucket, set the host to the domain name of the bucket.
      • If you want CDN to pull content from a custom domain name, specify the host. For example, suppose an origin server is bound to two sites, www.origin01.com and www.origin02.com, and the domain name connected to CDN is www.example01.com. If you need CDN to pull content from www.origin02.com, you would need to set the host to www.origin02.com.

      OBS Pull Authentication

      Applies when an OBS bucket is used as an origin server. Enable this switch if access to the bucket requires authentication. In this way, CDN PoPs carry the authentication information during origin pull. If the information does not match the OBS bucket, origin pull fails.

      • Enabled by default for a private bucket
      • Disabled by default for a public bucket

      Priority

      Enter a number from 1 to 1,000. A larger number indicates a higher priority.

      • CDN pulls content from the highest-priority origin server first. If that origin server is faulty, CDN pulls content from a lower-priority origin server.
      • You can configure up to six rules with unique priorities.
        NOTE:

        On April 10, 2025 (Beijing Time), CDN updated the origin server priority function and stopped using the concept of primary and standby origin servers. Currently, the default priorities of the original primary and standby origin servers are as follows:

        • Primary origin server: 70
        • Standby origin server: 30

      Weight

      The value ranges from 1 to 100. A larger value indicates that content is pulled from this origin server more frequently.

      • If there are multiple origin servers with the same priority, the weight determines the proportion of content pulled from each origin server.

      Origin Ports

      Ports for CDN PoPs to pull content. Range: 1 to 65535. Default ports: 80 for HTTP and 443 for HTTPS.

      • If Type is set to OBS bucket, the port numbers cannot be changed.
    2. Click OK. Repeat 4.a to add more origin servers. You can add up to 50 origin servers.
  5. (Optional) Configure a burst bandwidth alert. CDN will alert you if the access bandwidth reaches the configured Bandwidth Threshold (ranging from 1 Mbit/s to 10 Tbit/s). This helps you promptly identify abnormal requests and keep costs under control. By default, this function is enabled. Disable it if you do not need to configure it when adding a domain name.
  6. (Optional) Configure usage capping. CDN will disable the acceleration service for the domain name if its access bandwidth reaches the specified threshold, helping you keep costs under control. Select next to Usage Cap, as shown in Figure 4. Then, set the parameters based on Table 3.
    Figure 4 Usage capping
    Table 3 Parameter description

    Parameter

    Description

    Example

    Measurement to Cap

    Real-time usage: Collects the traffic/bandwidth statistics every 5 minutes.
    • The start time of a statistical period is a multiple of 5 minutes. For example, if a rule is configured at a time from 00:10:01 to 00:14:59, the start time of the first statistical period is 00:10:00 (rounding down to the nearest 5 minutes).

    Hourly cumulative: Collects statistics on the traffic accumulated every exact hour. For example, the first statistical period on October 19, 2023 is 00:00:00 to 00:59:59.

    • After a usage cap is set, the first statistical period may be less than one hour. For example, if the usage cap is set at 00:25:00 on October 19, 2023, the usage from 00:25:00 to 00:59:59 is collected in the first statistical period.

    Daily cumulative: Collects statistics on the traffic accumulated every day (UTC+08:00). For example, the statistical period on Oct 19, 2023 is 00:00:00 to 23:59:59.

    Real-time usage

    Usage Cap

    For real-time usage, you can set a traffic or bandwidth cap. For accumulated usage, you can only set a traffic cap.

    Bandwidth cap: Collects bandwidth usage every 5 minutes. You can set a bandwidth cap as required.

    Traffic cap: Collects traffic usage in the specified period. You can set a traffic cap as required.

    NOTE:

    The bandwidth and traffic conversion rules for usage capping are the same as those for billing. The default conversion rules are: 1 GB = 1,024 MB and 1 Gbit/s = 1,000 Mbit/s.

    Bandwidth cap

    10 Gbit/s

    Alarm Threshold

    When the ratio of the access traffic/bandwidth to the configured cap reaches the alarm threshold, CDN sends a message to you. The alarm threshold ranges from 10% to 90%.

    80%

    Uncap After

    Duration for disabling CDN after the bandwidth or traffic cap is reached. After the specified duration expires, CDN is automatically enabled for the domain name.

    Select 60 minutes, 12 hours, 24 hours, 3 days, or Never (manual uncap). If you select Never (manual uncap), you need to enable CDN for the domain name on the console if you want to use it again after it is blocked.

    12 hours

  7. Agree to the agreement by selecting I have read and agree to Cross-Border Data Transfer Compliance Commitment and click OK in the lower right corner of the page.
  8. Test your domain name before configuring a CNAME record that points your domain name to the assigned CNAME address to ensure that your domain configurations are correct.
    1. Ping the CNAME for the domain name you added to obtain the IP address.

      Example: If the domain name is www.example.com and the generated CNAME address is www.example.com.9c****e7.c.cdnhwc1.com, you can ping www.example.com.9c****e7.c.cdnhwc1.com to get the IP address 10.0.0.0.

    2. Edit the hosts file on the local PC.
      If you use a Windows system, map the domain name www.example.com to the IP address 10.0.0.0 in the hosts file in the C:\Windows\System32\drivers\etc\ directory.
      Figure 5 Testing the domain name
    1. Access your domain name to test services. If the test results meet your expectation, the configurations are correct.

Step 2: (Optional) Quickly Configure the Domain Name

After you add a domain name, configure it based on your service requirements. CDN provides recommended templates for different service types. These templates contain only a few configuration items. You can choose one of the following methods to add more configuration items:

  1. Select an existing template or create a new one to configure domain names in batches. For more information about templates, see Template Management.
  2. If you do not want to use a template, do as follows:
    1. Retain the recommended template configuration.
      Figure 6 Configuration methods
    2. Choose one or more configuration items under provided categories (basic configuration, higher hit ratio, higher access security, and higher access performance) based on your service requirements.
      Table 4 Configuration items

      Category

      Configuration Item

      Description

      Basic configuration

      HTTP Response Headers from PoPs to Clients (CORS)

      Define HTTP header values to control browser responses and prevent malicious CORS requests.

      Important notes:

      • HTTP header configuration is domain name-specific. When the configuration takes effect, the specified headers will be added to or removed from response messages for any resources under the entire domain. However, HTTP header configuration only affects the response behavior of the clients (browsers). They do not affect the cache behavior of CDN PoPs.
      • If a CORS rule is configured on the CDN console, synchronize it to your origin server. If your origin server is an OBS bucket, configure CORS on OBS.

      Origin Request Headers

      Add or delete specified HTTP headers during origin pull to rewrite the headers in the URLs of user requests.

      Important notes:

      • This setting only modifies HTTP messages for origin pull through CDN. It does not modify those in an HTTP message that CDN PoPs return to users.
      • A request header cannot have two different values at the same time.

      Higher hit ratio

      Cache Rules

      Set a proper cache TTL and priority for different resources to improve the cache hit ratio, reduce the origin pull ratio, and relieve the pressure on the origin server.

      Important notes:

      1. The cache rule priority is an integer ranging from 1 to 1,000. A greater number indicates a higher priority.
      2. After you modify or add a cache rule, purge the cache of the corresponding resource.
      3. Set the cache TTL of dynamic resources to 0, so dynamic resources are not cached. Otherwise, access exceptions may occur.

      Higher access security

      Configuring an HTTPS Certificate

      Configure a Secure Sockets Layer (SSL) certificate to improve the domain name security.

      Configuring TLS Versions and Cipher Suites

      Configure TLS versions and cipher suites as required.

      Force Redirect

      Enable this function to forcibly redirect requests from clients to CDN PoPs to HTTP or HTTPS.

      Filtering Requests from Specific Referers

      Set filtering policies for the values of the Referer header in HTTP requests to identify and filter out desired values, controlling access sources.

      Filtering Requests from Specific IP Addresses

      Set filtering policies to filter out requests from specific IP addresses, restricting access and preventing content theft and attacks.

      Filtering Requests from Specific User Agents

      Configure a User-Agent ACL for your domain name to identify and filter visitors and enhance domain name security.

      Filtering Requests from Specific Regions

      Prevent users in certain geographical locations from accessing your content.

      Token Authentication

      By default, the content distributed by CDN is public resources. Enable token authentication to protect these resources from being downloaded and stolen by malicious users.

      Higher access performance

      Range Requests

      Configure range requests to accelerate distribution of large files during origin pull and reduce bandwidth consumption.

      • Range requests are enabled by default for download acceleration.
      • The origin server must support the Range header.

      Smart Compression

      Compress static content on your websites by reducing file size. This speeds up file transfer and saves you a lot of bandwidth.

      • Smart compression includes gzip compression and Brotli compression. The performance of Brotli compression is 15% to 25% higher than that of gzip compression.
      • With smart compression, CDN automatically compresses .js, .html, .css, .xml, .json, .shtml, and .htm files.

      Redirect from Origin

      If 301 or 302 redirection is configured for the origin server address, the origin server returns status code 301 or 302 to CDN for a pull request. If this function is enabled on CDN, CDN PoPs will redirect to the address specified in the 301 or 302 response to obtain the resource, cache the resource, and return the resource to the user.

      HTTP/2

      HTTP/2 is a next-generation HTTP protocol. It delivers faster data transmission, consumes less bandwidth and traffic, and is less congestive than HTTP/1.x.

      OCSP Stapling

      With Online Certificate Status Protocol (OCSP) stapling, CDN queries and caches the status of online certificates in advance and returns the status to a browser when establishing a TLS connection with the browser. This means that the browser does not need to query the status from certificate authorities (CAs), accelerating the verification.

      QUIC

      Enable QUIC to improve transmission security, reduce transmission and connection latency, and prevent network congestion.

Step 3: Configure a CNAME Record

After you add a domain name, the system automatically assigns a CNAME to it. The CNAME cannot be accessed directly. You must configure a CNAME record that points your domain name to the assigned CNAME address at the DNS provider. This ensures that requests to your domain name are redirected to CDN PoPs for acceleration.

The following uses Huawei Cloud DNS as an example to describe the configuration process.

  • Obtaining the CNAME of the domain name
  1. Log in to the CDN console.
  2. In the navigation pane, choose Domains.
  3. In the domain name list, search for www.example.com and copy the CNAME www.example.com.9c****e7.c.cdnhwc1.com in the CNAME column.
  • Adding a CNAME record
  1. Log in to the DNS console.
  2. In the navigation pane, choose Public Zones.

    The public zone list is displayed.

  3. Click the domain name you want to add a record set to.
  4. Click Add Record Set in the upper right corner.
  5. Set the parameters as prompted. The following is an example:

    Type: Select CNAME – Map one domain to another.

    Name: Enter www.

    Line: Select Default.

    TTL (s): Retain the default value.

    Value: Enter www.example.com.9c****e7.c.cdnhwc1.com.

  6. Click OK.
    • After the CNAME record takes effect, the status changes to . However, CNAME resolution may fail the verification and the status changes to , indicating that no CNAME record is configured for the domain name. If you have correctly configured the CNAME record, ignore the error message.
    • A CNAME record takes effect immediately after being added. If you modify the CNAME record, then the change takes effect within 72 hours.
    • If you encounter a resolution conflict, see Rules for Handling Record Set Conflicts.

Step 4: Verify the CNAME Record

The length of time before the CNAME record takes effect depends on the DNS provider. To check whether a CNAME record has taken effect:

Open the Windows Command Prompt (cmd) and run the following command:

nslookup -qt=cname Acceleration domain name

If the CNAME is displayed, the CNAME record has taken effect.

If the CNAME record has taken effect, your domain name has been successfully connected to CDN for acceleration.