All Products
Search
Document Center

Edge Security Acceleration:Use EdgeScript in the DCDN console

Last Updated:Jun 16, 2026

In the DCDN console, you can create EdgeScript rules based on your EdgeScript code and publish them to the production environment to customize the management of DCDN products. This topic describes how to configure and use EdgeScript in the console.

Procedure

1

  1. Log on to the DCDN console.

  2. In the left navigation pane, click Domain Names.

  3. On the Domain Names page, find the domain name that you want to manage and click Configure.

  4. Click EdgeScript.

  5. Add a rule in the staging environment.

    1. On the Staging Environment tab, click Add Rule to configure an EdgeScript rule.

      Note
      • You can add only one EdgeScript rule for each domain name. If you need to add more rules, submit a ticket.

      • The staging environment supports only points of presence (POPs) in the Chinese mainland.

      custom rules

      The following table describes the rule parameters.

      Parameter

      Required

      Description

      Script Name

      Yes

      The rule name. Can contain only letters, digits, and underscores (_).

      Script Code

      Yes

      • You can enter the rule code directly or click Use Code Template to select a template for a specific use case.

      • You can write the rule code based on your use case. For more information, see EdgeScript use case examples.

      Priority

      Yes

      The rule priority. Valid values: 0 to 999. A larger value indicates a lower priority. Rules at different execution positions have independent priority settings.

      Run Script At

      Yes

      The execution position of the rule. For details, see Execution position and priority.

      Status

      Yes

      Enables or disables the rule.

      Break

      No

      When enabled, stops subsequent rules in the same phase from running after this rule matches.

      Extensions

      No

      Enables rule extensions. Currently, only the _es_dbg=signature field is supported, which enables debug mode.

    2. Click Publish to Staging Environment.

  6. Test the rule in the staging environment.

    Test scripts in the staging environment before publishing them to production. To get the staging test IP address, resolve the domain name staging.myalicdn.com. Then, map this IP address to the accelerated domain name in your client's hosts file.

    Add the mapping between the staging test IP address and the accelerated domain name to the hosts file. The path to the hosts file varies based on the operating system:

    • Windows: C:\Windows\System32\drivers\etc\hosts.

    • macOS: /etc/hosts.

  7. After the test is complete, click Publish All Rules to Production Environment to publish the rules from the staging environment to the production environment.

    Important

    Publishing rules to the production environment automatically clears them from the staging environment.

    publish to production environment

Roll back staging environment rules

To clear all configurations and reset the staging environment to its initial state, click Roll Back Scripts. In the dialog box that appears, click OK.

roll back to staging environment

Modify a script configuration

configuration modification process

To modify a rule in the production environment, do not edit it directly. Instead, copy it to the staging environment, make and test your changes, and then publish the updated rule back to production.

  1. Click Roll Back Scripts to reset the staging environment. This prevents interference from previous configurations.

  2. Click Copy Rules from Production Environment to copy the rules from the production environment to the staging environment. This avoids potential inconsistencies from manual copying.copy rules from production environment

  3. In the staging environment, add, modify, or delete rules.

  4. Click Publish to Staging Environment. Then, test the rules in the staging environment. For more information, see the Test the rule in the staging environment step.

  5. After testing, click Publish All Rules to Production Environment and verify that the rules work as expected in the production environment.

You can also manage EdgeScript by using the CLI. For details, see Use the CLI to manage EdgeScript.