This topic describes how EdgeScript works. This topic also describes the execution model of scripts in EdgeScript, positions where the scripts are executed, script priorities, and execution and termination of scripts.
Principles
The scripts that you configure by using EdgeScript serve the same purpose as the standard configurations in the ApsaraVideo Live console. Both of them are used to process the requests for ApsaraVideo Live. The following figure shows the positions where the scripts are executed. After a client sends a request to a content delivery network (CDN) node of ApsaraVideo Live, the ApsaraVideo Live gateway processes the request based on the scripts or the standard configurations that you configure in the ApsaraVideo Live console. You can execute a script at the start or end of a request processing pipeline by using the standard configurations in the ApsaraVideo Live console as a reference.

Model
- ES executes scripts to achieve different functions. Functions are triggered only when the conditions in scripts are met.
- You can specify the position where a script is executed and the priority of the script in a request processing pipeline.
- Scripts in ES are managed based on domain names.
Positions and priorities
- Positions
You can execute a script at the head or foot of a request processing pipeline.
- Head: for authentication, blocking, or throttling.
- Foot: for cache settings, back-to-origin authentication, and A/B testing.
- Priorities
If you want to execute more than one script at the head or foot of a request processing pipeline, you can assign priorities to these scripts to determine the execution order.
Execution and termination
- Execution of scripts
- If a condition that ends with
return true
in a script is met, the script is executed. - If a condition that ends with
return false
in a script is met, the script is skipped.
- If a condition that ends with
- Termination of scripts
For scripts that are executed in the same position, you can choose to skip the subsequent scripts when a script is executed.