Range origin fetch is a feature in which an Alibaba Cloud CDN point of presence (POP) includes an HTTP Range header in its origin fetch request. When the origin server receives this request from the Alibaba Cloud CDN POP, it returns only the specified portion of the resource based on the Range information in the HTTP request header. Range origin fetch improves file delivery efficiency, reduces back-to-origin traffic and origin server load, and speeds up resource response times.
Background information
The Range header is an HTTP request header that specifies which portion of a resource to retrieve. For example, Range: bytes=0-100 requests the first 101 bytes of the file.
After you enable range origin fetch, when CDN receives a user request, if the CDN POP does not have the resource cached or the cached resource has expired, the CDN POP performs an origin fetch using a Range request. It retrieves only the portions of the resource requested by the client, in segments, from the origin server and caches them on the CDN POP.
The following diagram shows how range origin fetch works:
Notes
Before enabling range origin fetch, note the following:
Confirm that your origin server supports Range requests. The origin server must process the Range header and return a 206 Partial Content status. If the origin server does not support Range requests, enabling this feature may cause cache errors or client request failures.
Range origin fetch is disabled by default in the CDN console.
The Multipart Ranges feature is disabled by default. Enabling range origin fetch does not enable Multipart Ranges. To enable Multipart Ranges, submit a ticket.
Enabling range origin fetch increases the queries per second (QPS) for origin requests. If your origin server has rate limiting enabled, this may trigger the limits. To prevent this, you can find the IP addresses of the CDN origin fetch nodes by calling the DescribeL2VipsByDomain operation. Then, you can add the IP addresses of the CDN origin fetch nodes to the IP address allowlist of your origin server.
Procedure
Log on to the CDN console.
In the left navigation pane, click Domain Names.
On the Domain Names page, find the target domain name and click Manage in the Actions column.
In the domain's navigation pane, click Video.
In the Range Origin Fetch section, click Modify.
Select one of the following options based on the parameter descriptions: Do Not Enable Range Origin Fetch, Match Client, or Enable Range Origin Fetch (Recommended for Large File Delivery).
If you select Match Client or Enable Range Origin Fetch (Recommended for Large File Delivery), you can set the shard size. The default shard size is 512 KB.
Parameter
Option
Description
Example
Range Origin Fetch
Do Not Enable Range Origin Fetch
The default setting is Do Not Enable Range Origin Fetch. With this setting, regardless of whether a client sends a Range request to a CDN POP, the CDN POP retrieves the entire file from the origin server. This results in lower file distribution efficiency in large file scenarios.
For example, a client sends a request that contains
Range: bytes=0-100to a CDN/ POP. The CDN/ POP sends a request to the origin server without the `Range` parameter. The origin server returns the entire file to the CDN/ POP. For example, if the file is 10 MB, the origin server returns the 10 MB file to the CDN/ POP. The CDN/ POP caches the file and returns the content specified byRange: bytes=0-100to the client.Match Client
After you enable Match Client, a CDN POP sends a Range request to the origin server only when the POP receives a Range request from a client. For the first origin request, the CDN POP requests a range from the origin server by rounding up the range size from the client's request to the nearest integer multiple of the shard size. All subsequent origin requests from the CDN POP use the shard size that you specify.
For example, if the shard size is 512 KB and a client sends a request to a CDN node that contains
Range:bytes=0-614399(600 KB), and the file is not cached on the CDN node, the first origin fetch retrieves a 1024 KB shard (600 KB is rounded up to 1024 KB). For subsequent client requests for other uncached shards of this file, the CDN node accesses the origin server using a shard size of 512 KB.Enable Range Origin Fetch (Recommended for Large File Delivery)
After you enable Enable Range Origin Fetch (Recommended for Large File Delivery), regardless of whether client requests to CDN POPs contain the Range header, CDN POPs always use Range requests for origin fetch. All origin-fetch Range requests from CDN POPs pull content from your origin server according to the shard size that you specify.
None
Shard Size
512 KB
1 MB
2 MB
4 MB
You can set the shard size if the origin fetch mode is set to Match Client or Enable Range Origin Fetch (Recommended for Large File Delivery). The default size is 512 KB.
1 MB
Rule Condition
Do not use: Do not use rule conditions.
To add or edit rule conditions, manage them in the Rules Engine.
Rule conditions identify various parameters in a user request to determine whether a configuration applies to the request.
Not used
Click OK.