All Products
Search
Document Center

CDN:Cache overview

Last Updated:Aug 11, 2026

When you use CDN to accelerate static resources, CDN caches the resources on the nearest POP. When you access a resource, you can retrieve it directly from the POP, which reduces latency and improves access efficiency. If the requested content does not exist on the POP or has expired, CDN requests the latest data from the origin server.

Cache POP hierarchy

CDN POPs are divided into L1 and L2 POPs. L1 POPs are widely distributed, and directly respond to users. L2 POPs are fewer in number and are responsible for fetching resources from the origin server and distributing them to L1 POPs. The data flow for requests is: Client → L1 POP → L2 POP → Origin server.

  • When a client requests a domain name, it first queries the local DNS for the IP address corresponding to the domain name, and CDN schedules and assigns the appropriate POP.

  • When an L1 POP has the cached resource, it returns the data directly to the client.

  • When an L1 POP does not have the cached resource, it requests the resource from an L2 POP. If the L2 POP has the cache, it syncs the resource to the L1 POP and returns it to the user. If the L2 POP also does not have the cache, it fetches the resource from the origin server and caches it according to the configured caching policy.

Note

The cache hit ratio displayed in the console only reflects the hit ratio of L1 POPs. When L1 POPs miss, they first request from L2 POPs rather than going directly to the origin server, so the actual hit ratio is slightly higher than the value shown in the console.

Cache-related features

Use the following features to control the caching behavior for your accelerated domain names.

Feature

Description

Configure TTL for cache rules

By configuring cache expiration rules, you can control the cache duration for resources on CDN points of presence (POPs) to balance content freshness, access performance, and origin fetch costs. This document explains how to configure and validate cache rules, provides troubleshooting guidance, and outlines best practices.

Configure TTL for status codes

When a CDN POP fetches a resource from your origin server, the origin returns an HTTP status code. By default, CDN uses the origin's cache headers to decide whether and how long to cache that status code. Status code TTL lets you override this behavior: set a custom cache duration per status code so POPs serve it directly to clients without performing a new origin fetch until the TTL expires.

Configure TTL for status codes (Honor Origin)

Use the Status Code TTL (Honor Origin) feature to set the time-to-live (TTL) for static resources on CDN points of presence (POPs) based on origin response status codes.

Modify outgoing response headers

Alibaba Cloud CDN allows you to add, modify, or delete HTTP response headers returned to end users. You can use custom response headers to control client caching behavior, enable cross-origin resource sharing (CORS), set security policies, and customize the content and format of client responses.

Configure custom error pages

You can configure Alibaba Cloud CDN to return a custom error page when a client requests content that does not exist or an error occurs. Instead of a default error message, a CDN point of presence (POP) serves a page you specify, providing a helpful and branded user experience.

Rewrite access URLs

If the path of a resource on the origin server changes, the path of the resource on the CDN node also changes. If a user requests the original URL, the CDN node rewrites the request URL to the target path to reduce origin-pulls and improve client access performance.

Configure a custom cache key

You can consolidate requests that access the same file into a single cache key. This prevents different requests from being cached as different files and reduces origin fetches.

Custom cache key rules generate cache keys from specific parts of an HTTP request, such as the URI, request parameters, HTTP headers, or custom variables. By consolidating requests for the same resource into a uniform cache key, this feature improves cache hit ratios, reduces origin fetches, and lowers response times and bandwidth consumption.

Configure a shared cache

Cache sharing allows multiple accelerated domain names under the same Alibaba Cloud account to share cached resources on CDN points of presence (POPs). When multiple domain names serve many common assets, such as images, CSS, and JavaScript files, configuring cache sharing prevents duplicate origin fetches. This improves the cache hit ratio and reduces origin traffic.

Configure cross-origin resource sharing (CORS)

After you add your service to Alibaba Cloud CDN, you can enable cross-origin access by configuring HTTP response headers on POPs.