EdgeScript enables script-based programmable configurations for Content Delivery Network (CDN). You can use EdgeScript to efficiently customize the CDN service according to your business needs. In the CDN console, you can create EdgeScript rules based on the EdgeScript coding standard, and publish the rules to the production environment to customize your CDN service. This topic describes how to configure EdgeScript rules in the CDN console.

Background information

The following figure shows the process of configuring EdgeScript rules in the CDN console.Process of configuring EdgeScript rules in the CDN console

Procedure

  1. Log on to the Alibaba Cloud CDN console.
  2. In the left-side navigation pane, click Domain Names.
  3. On the Domain Names page, find the target domain name and click Manage.
  4. In the left-side navigation pane of the specified domain, click EdgeScript.
  5. Add a rule to the staging environment.
    1. On the Staging Environment tab, click Add Rule.
      Staging environment
    2. In the dialog box that appears, set the parameters for the target rule.

      For more information about the EdgeScript parameters, see Fields.

      Add a rule
    3. Click Publish to Staging Environment.
  6. Test all rules in the staging environment.
    The following figure shows the IP address of the host for testing the rules in the staging environment. Use the IP address of the test host actually displayed in the console.IP address of the test host
  7. After you test the rules, click Publish All Rules to Production Environment to publish all rules from the staging environment to the production environment.
    Publish all rules to the production environment
  8. To add rules or modify the rules already published to the production environment, you must copy the rules from the production environment to the staging environment, and then edit them. Click Copy Rules from Production Environment to synchronize the rules from the production environment to the staging environment.
    Notice After you publish rules from the staging environment to the production environment, the rules in the staging environment are automatically cleared.
    Copy rules from the production environment
    After you synchronize the rules from the production environment to the staging environment, you can modify the existing rules or add more rules in the staging environment.Edit rules in the staging environment