If a request that is redirected from a point of presence (POP) to the origin server includes the Range header, the origin server returns the content that is specified by the Range header to the POP. This process is called range origin fetch. Range origin fetch accelerates content delivery by increasing cache hit ratios, reduces origin traffic and loads on origin servers, and speeds up site response.
Background information
The Range header is an HTTP header that specifies the part of content to be retrieved. For example, Range: bytes=0-100
specifies that the origin server is required to return the first 101 bytes in the requested file.
After you enable the range origin fetch feature, requests for resources that have expired or are not cached on POPs are redirected to the origin server with the Range header retained. Then, Alibaba Cloud CDN retrieves the specified file chunk from the origin server and caches the file chunk on POPs.
The following figure shows how the range origin fetch feature works.
Usage notes
When you enable the range origin fetch feature, take note of the following rules:
Make sure that the origin server supports HTTP range requests, and the origin server can respond to requests with the HTTP 206 status code (partial content message). If the origin server does not support HTTP range requests, resources cannot be cached on POPs after range origin fetch is enabled.
The range origin fetch feature is optional and is disabled by default.
Procedure
Log on to the Alibaba Cloud CDN console.
In the left-side navigation pane, click Domain Names.
On the Domain Names page, find the domain name that you want to manage and click Manage in the Actions column.
In the left-side navigation pane of the domain name, click Video.
In the Range Origin Fetch section, click Modify.
Set the Range Origin Fetch parameter to On or Force.
Parameter
Description
Example
Range Origin Fetch
Off
The default value is Off. POPs retrieve the entire file from the origin server regardless of whether the request carries the Range header. In this case, the file distribution efficiency is lower than expected in large file distribution scenarios.
A client sends a request that contains
range:0-100
to a POP. The POP redirects the request to the origin server without the Range header. The origin server returns the entire file to the POP. If the total size of the file is 10 MB, the origin server returns 10 MB of file data to the POP. The POP caches the received file and returns the chunk that is specified byrange:0-100
to the client.On
If you set the Range Origin Fetch parameter to On, POPs redirect requests with the Range header retained to the origin server. For the first request for a resource that is redirected to the origin server, Alibaba Cloud CDN rounds up the value of the Range header to the nearest integer. For subsequent requests for the resource, Alibaba Cloud CDN sets the value of the Range header to 512 KB.
For example, a client requests content that is 600 KB in size. The POP retrieves content that is 1,024 KB in size from the origin server for the request and returns file chunks that are 512 KB in size for subsequent requests.
A client sends a request that contains
range:0-100
to a POP. The POP rounds up the value of the Range header to 512 KB and redirects the request to the origin server. The origin server returns a file chunk that is 512 KB in size. Then, the POP caches the file chunk and returns a file chunk of the size that is specified byrange:0-100
to the client.Force
If you set the Range Origin Fetch parameter to Force, POPs redirect the requests of a client to the origin server with the Range header retained, regardless of whether the requests contain the Range header. All files that are returned from the origin server to POPs are split into chunks that are 512 KB in size.
None.
Rule Condition
Rule conditions can identify parameters in a request to determine whether a configuration takes effect on the request.
Do not use conditions
Select the configured rule conditions in Rules Engine. For more information, see Rules engine.
Click OK.