EdgeScript (ES) allows you to customize CDN configurations by running scripts if the standard configurations in the CDN console cannot meet your business requirements.
ES supports easy-to-learn syntax and provides a large library of functions. You can use the syntax and functions to customize CDN features.
ES provides encapsulated functions, simple decision-making statements, and built-in variables that can be recognized by CDN points of presence (POPs).CDN You can combine simple variables and existing functions in ES to meet most of your requirements for custom configurations. For example, you can use ES to customize authentication, caching, and throttling, and add fields to or remove fields from request headers. This helps you customize your configurations and provides agile and fast service updates.
- For more information about variables, see EdgeScript built-in variables.
- For more information about functions, see EdgeScript built-in functions.
- For more information about logical functions, see Logical functions.
Billing
ES is free of charge.
Use scenario
Action | Description |
---|---|
Customize authentication logic | To prevent hotlinking in VOD and live streaming scenarios, authentication is required. ES allows you to customize authentication logic to authenticate requests based on parameters, cookies, or algorithms. Authentication reinforces protection for resources on your origin server. |
Customize request and response headers | ES allows you to modify request and response headers based on your business requirements. |
Rewrite and redirect requests | If your website supports different languages, requests destined for the website are redirected to the URLs that point to content written in the requested language. For example, requests that require the English or German language are redirected from the China site to the English or German site. |
Run A/B tests | Before you release a new feature, you can use CDN to run A/B tests. You can send requests that carry different request headers or URLs to different origin servers. These requests trigger different features on the origin servers. |
Customize caching | If the standard time-to-live (TTL) values or cache expiration rules for cached content cannot meet your business requirements in certain scenarios, you can run scripts to create custom caching rules. |
Throttle requests | ES allows you to throttle requests from different users, such as free users and paying users. You can run scripts to configure and enable throttling. |
Block requests | ES allows you to run scripts to block requests from specified IP addresses. You can specify the regions or logic based on which requests are blocked. You can also create anti-bot policies to protect your resources from bots. |