All Products
Search
Document Center

Server Load Balancer:AScript

Last Updated:Dec 13, 2024

AScript allows you to create scripts for standard Application Load Balancer (ALB) instances. The letter "A" in AScript stands for agile, application-oriented, and Alibaba Cloud-developed. AScript provides powerful customization capabilities that enable you to perform secondary development when standard configurations in the ALB console cannot meet your business requirements.

What is AScript?

AScript provides easy-to-learn syntax and many functions that allow you to create custom ALB configurations.

image

AScript provides encapsulation-free functions, built-in variables, and the if-else statement. You can use variables and functions to create custom forwarding rules. This way, your business can quickly adapt to changes.

For more information about the AScript syntax, see AScript syntax.

Use scenarios

Scenario

Description

Hotlink protection

You can use AScript to customize authentication algorithms, User-Agent (UA) blacklists, and Referer whitelists. AScript allows you to customize the authentication logic and authenticate requests based on request parameters, cookies, or algorithms. This helps you protect your resources against attacks.

Access control based on whitelists or blacklists

You can use AScript to configure an IP blacklist or whitelist to control access from clients.

Request and response header customization

You can use AScript to modify variables, such as request and response headers, based on your business requirements.

Request rewrites and redirects

You can use AScript to rewrite request URIs and file extensions, add URI prefixes, and perform 302 redirects. This way, you can rewrite requests or redirect them to the desired resources. If your website supports different languages, requests destined for the website are redirected to the URLs that point to the content written in the requested language. For example, requests that require English or German are redirected from the China site to the English or German site, respectively.

Billing

For information about how the number of rule evaluations affects the Load Balancer Capacity Unit (LCU) fee, see ALB billing rules.