All Products
Search
Document Center

Server Load Balancer:AScript overview

Last Updated:Mar 13, 2024

AScript allows you to create programmable scripts for standard Application Load Balancer (ALB) instances. The letter "A" in AScript stands for agile, application-oriented, and Alibaba Cloud. AScript provides powerful customization capabilities that allow 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 a large number of functions that allow you to customize 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 syntax of AScript, see AScript syntax.

Scenarios

Scenario

Description

Hotlink protection

You can use AScript to customize authentication algorithms, User-Agent (UA) blacklists, and Referer whitelists. You can use AScript 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 requests 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 the English or German language are redirected from the China site to the English or German site.

Billing

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