EdgeScript is a script tool that Alibaba Cloud designs to support programmable configuration. EdgeScript allows you to create scripts to customize your ApsaraVideo Live service. If the standard configurations provided in the ApsaraVideo Live console cannot meet your business requirements, you can use EdgeScript to create scripts by using simple programming methods.

Features

EdgeScript is a script tool that Alibaba Cloud designs to help you efficiently customize your ApsaraVideo Live and Alibaba Cloud CDN services. EdgeScript provides simple syntax and diverse functions, which allows you to create complex scripts with ease. EdgeScript allows you to build a custom business system based on ApsaraVideo Live. Custom scripts can globally take effect in the ApsaraVideo Live service within several seconds. Agile and fast service releases and updates help you develop services in a more efficient way.

The simple syntax and diverse functions of EdgeScript can help you build script blocks to customize the configurations of ApsaraVideo Live.

What is EdgeScript

EdgeScript provides built-in variables that the content delivery network (CDN) nodes of ApsaraVideo Live can recognize, simple conditional statements, and diverse functions encapsulated by ApsaraVideo Live. You can combine simple conditional statements and existing functions in EdgeScript to meet most of your requirements for custom configurations. For example, you can use EdgeScript to customize authentication and add fields to or remove fields from request headers. This helps you customize your configurations and provides agile and fast service updates.

Scenarios

EdgeScript is applicable to various business scenarios where custom configurations are required.

Scenario Description
Authentication logic Hotlink protection is often required for ApsaraVideo Live. You can use EdgeScript to implement authentication based on request parameters, cookies, or some complex algorithms. This way, you can protect resources.
Request headers and response headers You can use EdgeScript to customize filtering rules of request headers and response headers and fully control the requests sent to the live centers of ApsaraVideo Live.
Rewriting and redirection In this scenario, EdgeScript applies to multilingual websites. For example, a multilingual website supports Chinese, English, and German. The website of the Chinese version may perform a 302 redirect to a location. The website of the English or German version may perform a 302 redirect to another location.
A/B testing You may need to perform A/B testing on a new feature that is added to the origin server. In this case, the ApsaraVideo Live service is required. You can differentiate requests for different features of the origin server based on the request headers or URLs. This can help you perform end-to-end A/B testing.
M3U8 rewriting In this scenario, EdgeScript applies to ApsaraVideo Live and ApsaraVideo VOD services.
Blocking You can use EdgeScript to customize blocking for requests based on the request logic, the IP addresses of the clients that send the requests, or the regions from which the requests are sent. In addition, you can use EdgeScript to configure anti-crawler rules to prevent resources from being crawled.

Billing methods

You can use EdgeScript free of charge. Feel free to use it.

Procedure

You can use EdgeScript to customize configurations in the ApsaraVideo Live console. To publish a script to the production environment, perform the following steps:

  1. Use EdgeScript to create a script and save the script.
  2. Publish the script to the staging environment.
  3. Test the script.
  4. Publish the script from the staging environment to the production environment.

For more information, see EdgeScript.

Note For more information about how to use the EdgeScript command-line interface (CLI), see Use the EdgeScript CLI to configure scripts.

Learning paths

  1. For more information about the protocols supported by different EdgeScript API operations, see Limits.
  2. For more information about the syntax of EdgeScript, see EdgeScript syntax.
  3. For more information about the variables, functions, and condition-based judgment of EdgeScript, see Built-in variables and Built-in functions.
  4. For more information about how to use EdgeScript to create a script in the ApsaraVideo Live console, see EdgeScript.