When Alibaba Cloud CDN accelerates static resources, it caches them on the point of presence (POP) nearest to the user. On the next request, the POP returns the cached resource directly — no origin fetch needed. If the resource doesn't exist on the POP or has expired, the POP retrieves the latest version from the origin server.
How caching works
Cache hit: The POP has a valid cached copy and returns it directly to the user.
Cache miss or expiry: The POP fetches the resource from the origin server, caches it, and returns it to the user. The time-to-live (TTL) you configure on the POP determines how long a resource is considered valid before a new origin fetch is triggered.
Improve the cache hit ratio
A higher cache hit ratio means fewer origin fetches, lower origin traffic, and faster response times. The most common causes of a low cache hit ratio are variable request parameters and inconsistent URL formats.
Normalize query strings: If your origin returns the same content regardless of query string order or values, use Custom Cache Key to define exactly which parameters form the cache key. This prevents example.com/file?a=1&b=2 and example.com/file?b=2&a=1 from being cached as separate entries.
Consolidate similar URLs: URLs that differ only in insignificant parameters should map to the same cache key. Use URL rewrite rules to normalize request paths before they reach the cache layer.
Set appropriate TTLs: Short TTLs cause frequent origin fetches. Match TTL values to how often your content actually changes — static assets like images and fonts can use long TTLs (days or weeks), while frequently updated files should use shorter ones.
Share cache across domain names: If multiple accelerated domain names in the same Alibaba Cloud account serve common assets (images, CSS, JavaScript), configure cache sharing so those domain names draw from the same POP cache instead of each fetching from the origin independently.
Related features
The following features let you control caching behavior for a domain name.
| Feature | Description |
|---|---|
| Configure CDN cache expiration time | Set TTL rules by file directory or file name extension. When a cached resource expires, subsequent requests trigger an origin fetch. |
| Configure status code TTL | Cache HTTP status codes so the POP returns them directly without an origin fetch. When the cached status code expires, a new origin fetch is triggered. |
| Configure TTL for status codes (honor origin) | Set TTL for static resources based on the status codes returned by origin responses. |
| Configure an outgoing response header | Control how clients handle caching via HTTP response headers. Also used to enable cross-origin resource sharing (CORS). |
| Create a custom error page | Return a custom error page instead of the default when content is missing or an error occurs. |
| Create an access URL rewrite rule | Rewrite request URLs on the POP when the resource path on the origin server changes, reducing origin requests. |
| Custom Cache Key | Define cache keys using any combination of URI, request parameters, HTTP request headers, and custom variables. Prevents the same resource from being cached as multiple entries, improving the cache hit ratio. |
| Configure cache sharing | Let accelerated domain names in the same Alibaba Cloud account share cached resources on CDN POPs, reducing bandwidth usage and origin traffic. |
| Configure cross-origin resource sharing | Add HTTP response headers to enable cross-origin access to your resources. |
FAQ
What is the CDN/DCDN cache purge mechanism?
See Cache-related FAQ.
What is the default CDN/DCDN cache rule?
See Cache-related FAQ.
How do I determine whether a resource is cached on a CDN/DCDN POP?
See Cache-related FAQ.
How do I resolve a low CDN/DCDN cache hit ratio caused by variable parameters in URLs?
See Cache-related FAQ.
How do I configure files to be fetched directly from the origin server instead of being cached?
See Cache-related FAQ.
Why is the content not up-to-date even though the cache TTL is set to 0 in the CDN/DCDN console?
See Cache-related FAQ.
Are caches on CDN/DCDN POPs updated automatically and in real time after a file is updated on the origin server?
See Cache-related FAQ.
What factors can lower the CDN/DCDN cache hit ratio?
See Cache-related FAQ.
How do I troubleshoot a low cache hit ratio?
See Cache-related FAQ.
How do I configure global cache settings?
See Cache-related FAQ.
Why is the content served by CDN different from the content on the origin server?
See Why is the content served by CDN different from the content on the origin server?
Why did my cache configuration not take effect?
See Cache-related FAQ.
Configure cross-origin resource sharing (CORS) for CDN
Why do I still receive a cross-origin error and the configured response header is missing after I configure the Access-Control-Allow-Origin response header?
See Cache-related FAQ.
What are the cache rules for abnormal status codes?
See Cache-related FAQ.
What is the difference between outgoing and incoming response headers?
See Cache-related FAQ.
How do I configure an entire domain name to not be cached?
See Cache-related FAQ.
Does CDN support multi-replica caching?
See Cache-related FAQ.
How do I set the server-side cache TTL when using CDN to accelerate static resources?
See Cache-related FAQ.