Updated on 2025-06-06 GMT+08:00

Template Management

CDN allows you to customize templates for quick domain configuration. You can define function settings in one template and apply it to multiple domain names.

Scenarios

This function is useful when you want to use the same rule for multiple domain names, for example, the same referer validation rule for five domain names.

Constraints

  • Templates can include HTTP header, cache rule, redirect from origin, smart compression, range requests, referer validation, IP ACL, User-Agent ACL, and usage cap settings.
  • The system automatically creates a cache rule whose type is All files and priority is 1 for a template, unless you have set one All files rule when creating the template. The priority of other rules cannot be 1.

Creating a Template

  1. Log in to Huawei Cloud console. Choose Service List > Content Delivery & Edge Computing > Content Delivery Network.

    The CDN console is displayed.

  2. In the navigation pane, choose Domains.
  3. Click the Templates tab.
  4. In the Templates area, click Create. The Create Template page is displayed.
    Figure 1 Creating a template
  5. Enter the template name and description, and select the configuration items to be contained in the template.
  6. Configure rules for the selected configuration items and click OK.

Applying a Template to Domain Names

You can apply a created template to domain names. This will overwrite their original configuration with that in the template.

  1. In the template list, click Apply to Domains in the Operation column of a template.
  2. In the displayed dialog box, select target domain names and click to add them to the right area.
    • Select up to 50 domain names at a time.
  3. Click OK.

Checking Template Application Records

In the Application Records area, you can view the following information of a template application record:

  • Domain names to which the template is applied: Click View Domains in the Operation column to view the target domain names and whether the application is successful.
  • Whether the template is used: In the Status column, view the number of domain names that the template is used, fails to be used, or is being configured.
  • Template configuration: Click Template Snapshot in the Operation column to view the configuration items contained in the template when the template is used.
Figure 2 Template application records