EdgeScript (ES) scripts work the same as the standard configurations specified in the CDN console — they process requests sent to CDN points of presence (POPs).
How it works
When a CDN point of presence (POP) receives a request, it processes that request using two sources of logic: the standard configurations in the Alibaba Cloud CDN console and any ES scripts you have deployed. ES scripts run inside the request processing pipeline, at a position you choose.

Scripts are managed per domain name. Each script runs when its conditions are met and executes at the position (head or foot) and priority you configure.
Execution positions
ES scripts run at two positions in the request processing pipeline: head (before the CDN console configurations are applied) and foot (after they are applied).

Choose a position based on what your script needs to do:
| Position | Runs | Use cases |
|---|---|---|
| head | Before CDN console configurations | Authentication, blocking, throttling |
| foot | After CDN console configurations | Cache settings, back-to-origin authentication, A/B testing |
Script priorities
When multiple scripts are assigned to the same position (head or foot), priorities determine the execution order.
Rule evaluation
Each ES script contains rules that define when the script acts on a request:
A rule hits when the rule contains
if condition {}andconditionevaluates to true.A rule does not hit when
conditionevaluates to false, or when the rule contains noif condition {}syntax.
Functions in a script run only when their conditions are met.
Script termination
For scripts running at the same position, you can configure a script to stop execution of subsequent scripts once it has run. This lets you short-circuit the processing pipeline.