Anti-DDoS Proxy integrates web page caching with its scrubbing centers to protect your website services against DDoS attacks and accelerate access to static web pages. This topic explains how to enable and configure the website acceleration feature.
How it works
When a client requests a page, Anti-DDoS Proxy checks whether the page contains resource types covered by the active caching rule. If it does, the page is cached in the protection clusters. Subsequent requests for the same page are served directly from the cache, without reaching the origin server.
Cache freshness vs. cache retention
These two behaviors are independent and easy to confuse:
Cache freshness (Cache Expires In): How long a cached resource is considered valid before Anti-DDoS Proxy checks the origin again. Configurable per custom rule: 1 hour, 1 day, 10 days, or 30 days.
Cache retention (inactivity eviction): How long a resource stays in cache on a single host. A resource is evicted after 5 minutes of inactivity, regardless of the Cache Expires In setting. If a client requests the resource after eviction, Anti-DDoS Proxy fetches it from the origin server again.
The website acceleration feature is designed for volumetric attack scenarios and behaves differently from Alibaba Cloud CDN. In low queries per second (QPS) environments, Anti-DDoS Proxy may frequently return X-Cache: MISS because cached resources are evicted before the next request arrives.
X-Cache response header
Anti-DDoS Proxy uses the X-Cache HTTP header to indicate cache status:
| Condition | Header returned to client |
|---|---|
Origin response includes X-Cache | Anti-DDoS Proxy passes the header through unchanged |
Origin response does not include X-Cache | Anti-DDoS Proxy returns X-Cache: MISS |
Prerequisites
Before you begin, ensure that you have:
A website added to an Anti-DDoS Proxy instance that uses the Enhanced function plan. See Add one or more websites
Enable static page caching
Log on to the Anti-DDoS Proxy console.
In the top navigation bar, select the region of your instance:
Chinese Mainland — for Anti-DDoS Proxy (Chinese Mainland) instances
Outside Chinese Mainland — for Anti-DDoS Proxy (Outside Chinese Mainland) instances
In the left-side navigation pane, choose Anti-DDoS Lab > Website Acceleration.
Select the domain name you want to manage.
In the Static Page Caching section, turn on Status, then set the Mode parameter. After you enable a mode, the caching policy applies to all URIs in the domain. To cache only a specific URI, set Mode to No Caching and create a custom caching rule for that URI.
ImportantStatic page caching can only be enabled for domain names associated with an Anti-DDoS Proxy instance that uses the Enhanced function plan.
Mode What gets cached Standard Pages that contain static resources (CSS, JavaScript, or TXT files) Enhanced All requested pages No Caching Nothing — use this when you want custom rules to control caching for specific URIs
Create a custom caching rule
Custom caching rules let you apply a specific caching mode and expiry to a single URI path. A custom rule takes priority over the domain-level caching mode and is subject to a limit of five rules.
Custom caching rules only take effect when Status is turned on.
In the Static Page Caching section, click Settings.
On the page that appears, click Create Rule in the upper-right corner.
In the Create Rule dialog box, configure the following parameters, then click OK.
Parameter Description Rule name A name for the rule. Use letters, digits, and underscores only. Maximum length: 128 characters. URI The URI path to cache. Wildcards and request parameters are not supported. For example, /a/matches all pages under<domain>/a/.Mode The caching behavior for the matched URI: Standard Mode (cache pages with static resources), Strong Mode (cache all pages), or No Caching (bypass cache). Cache Expires In How long cached resources are considered fresh. Default: Use Origin Configurations (honors the origin server's cache headers). Other options: 1Hours, 1Days, 10Days, 30Days. Resources are still evicted after 5 minutes of inactivity, regardless of this setting.
After the rule is created, it appears in the rule list. Use the Edit and Delete actions to manage the rule.
Refresh the cache
To force Anti-DDoS Proxy to fetch a fresh copy from the origin, click Refresh Cache in the rule list.
Use this after updating origin content when you want the cache to reflect the change immediately, without waiting for the resource to expire or be evicted.
Limitations
| Limitation | Detail |
|---|---|
| Required plan | Website acceleration is only available on the Enhanced function plan |
| Custom rules | Maximum of 5 |
| URI matching | Wildcards and request parameters are not supported in custom rule URIs |
| Cache retention | 5 minutes of inactivity per host; not configurable |