Cache Configuration Overview

2024-06-13 06:52:56

What is Cache

The AOne EdgeTrans supports both static and dynamic business acceleration and the static acceleration is mainly enabled by the cache technology. Generally, the multi-level cache architecture is used to improve the cache hit ratio. If the business data of your origin server contains static resources, you can configure cache information on the console. Upon configuration, when the first user requests the static resources on the origin server, AccessOne EdgeTrans obtains the static resources from the origin server and sends them to the user, and caches the static resources on the edge node closest to the user. When other users access the same static resources, the cache node directly returns the resources without forwarding the requests to the origin server. If the static resources requested by users are not cached on the edge node, the requests are forwarded to the higher-level node, which directly responds with the requested resources if they are cached. Such multi-level caching architecture enables more efficient resource access.

Cache Configuration Overview

The section introduces how to configure the cache time-to-live (TTL), status code expiration time, HTTP response headers, custom error pages, custom redirects, and custom cache keys.

Before you start the configuration, ensure that static acceleration has been enabled. If static acceleration is not enabled, all files will not be cached.

Feature

Description

Configuring the Cache TTL

Cache TTL is the amount of time that an origin server resource is cached on the edge node. After TTL ends, the edge node will mark the corresponding resource as expired. If the resources requested by the client have expired, the edge node obtains the latest resources from the origin server and caches them for other requests. You can cache files by filename extension, directory, homepage, all files, or full path. You can create a cache TTL for static resources based on file directories or file name extensions.

Configuring Expiration Time for Status Code

When the edge node obtains resources from the origin server, the server will return a response status code. You can configure the expiration time of the status code on the Console. The edge POP will cache the status code locally. Before the status code expires, if the client sends another request for the same resources to the integrated CDN POP, the edge node will directly respond with the cached status code instead of forwarding the requests to the origin server, reducing the pressure on the origin server. When the caching time of the status code on the edge node expires, requests that trigger the code are redirected to the origin server.

Customizing an Error Page

When a page access error occurs, the client shows a default error page, such as: 404 Not Found. The default error page is not visually appealing in most cases, resulting in a poor user experience. To improve user experience, you can configure edge POPs so that requests are redirected to custom error pages when errors occur.

Customizing Redirects

If a resource on the origin server relocates, the URL of the resource changes. When user requests use the original URL, CDN POPs must rewrite the URL so that the requests can be redirected to the new URL. For example, a video-on-demand (VOD) file is moved from the /stream/ directory to the /vod/ directory. Through 302 redirect, the can obtain the changed URL in the Location header and resend an access request to the edge node. This ensures that the user can obtain the correct file.

Customizing Cache Keys

The cache key is a sole identifier when a file is cached on an edge POP, and there is a one-to-one relationship between the cache file and cache key. By default, in general, the cache key is the origin of the request from a client.

Configuring CORS

HTTP response headers are a component of the header section in HTTP response messages. HTTP response headers carry and bring specific response header parameters to clients. After you customize an HTTP response header, the response message returned by the AccessOne EdgeTrans carries the customized header configured, to implement a specific feature when a user requests a resource on an accelerated domain. CORS is also known as cross-origin access, which is a standard cross-origin solution provided by HTML5. CORS allows web application servers to perform cross-origin access control and ensure secure cross-origin data transmission. When cross-origin resource sharing or access is required in your business, you can configure custom HTTP response headers.


Fs60_pH9XU7.