All Products
Search
Document Center

CDN:How EdgeScript works

Last Updated:Apr 01, 2026

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.

CDN

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).

ES

Choose a position based on what your script needs to do:

PositionRunsUse cases
headBefore CDN console configurationsAuthentication, blocking, throttling
footAfter CDN console configurationsCache 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 {} and condition evaluates to true.

  • A rule does not hit when condition evaluates to false, or when the rule contains no if 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.