You can create and publish EdgeScript rules in the ApsaraVideo VOD console to customize ApsaraVideo VOD behavior.
Configuration workflow

-
Log on to the ApsaraVideo VOD console.
In the left-side navigation pane, choose Configuration Management > CDN Configuration > Domain Names.
-
On the Domain Names page, click Configure for the accelerated domain name you want to use.
-
Click the EdgeScript tab.
-
Add a rule in the staging environment.
-
On the Staging Environment tab, click Create Script to configure an EdgeScript rule.
Note-
You can add only one EdgeScript rule for each domain name. To add more rules, contact your Alibaba Cloud account manager or reach out through other channels.
-
The staging environment supports only nodes in the Chinese mainland.
The following table describes the parameters.
Parameter
Required
Description
Rule name
Yes
The rule name. Only letters, digits, and underscores (_) are allowed.
Rule code
Yes
The code of the rule.
-
Enter the rule code directly, or click Use Code Template to select a template.
-
Write custom rule code for your use case. For more information, see EdgeScript scenario examples.
Priority
Yes
The rule priority. Valid values: 0 to 999. A larger value indicates a lower priority. Priorities are independent across execution points.
Execution point
Yes
The execution point of the rule. For more information, see Execution points and priorities.
Status
Yes
Specifies whether the rule is enabled or disabled.
Break
No
If enabled, subsequent rules at the same execution point are skipped after this rule is matched.
Extension
No
Optional extensions. Currently, only
_es_dbg=signatureis supported, which enables debug mode. -
-
Click Publish to Staging Environment.
-
-
Test the rule in the staging environment.
Test EdgeScript rules in the staging environment before publishing them to production. Resolve the domain name
staging.myaliCDN.comto obtain the staging environment test IP address, then bind the accelerated domain name to that IP address in the hosts file on your client.Add the mapping between the staging environment test IP address and the accelerated domain name to the hosts file. The hosts file path varies by operating system:
-
Windows:
C:\Windows\System32\drivers\etc\hosts -
macOS:
/etc/hosts
-
-
After the test is complete, click Publish All Scripts to Production Environment to publish the rules from the staging environment to the production environment.
ImportantAfter you publish rules to the production environment, the original rules in the staging environment are automatically cleared.
Roll back staging environment rules
To clear all configurations and revert the staging environment to its initial state, click Roll Back Script. In the dialog box that appears, click OK.
Configuration modification workflow

Do not modify rules directly in the production environment. Instead, copy the rules to the staging environment, make your changes, and test them. After confirming that the rules work as expected, publish them to production.
-
Click Roll Back Script to revert the staging environment to its initial state. This prevents interference from previous configurations.
-
Click Copy Script from Production Environment to synchronize rules from production to staging. This prevents inconsistencies from manual copying.
-
Add, modify, or delete rules in the staging environment.
-
Click Publish to Staging Environment to publish the modified rules to the staging environment. Then, test the rules. For more information, see Test the rule in the staging environment.
-
After the test is complete, click Publish All Scripts to Production Environment. Then, test the rules in the production environment to verify that the configuration works as expected.