Range requests refer to origin requests that include the Range header. When an origin server receives a range request, it immediately serves the requested range from the cache if the Edge Security Acceleration (ESA) cache contains the requested range. Range requests speed up file distribution, increase cache hit ratios, boost resource response times, and reduce origin traffic.
How it works
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 of the requested file.
When ESA receives a Range request, it forwards the request to the origin if the requested range is not cached or has expired. ESA then caches the retrieved resource at its points of presence (POPs) for future requests.
The following figure shows how range requests work:
Before you begin
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.
If the requested resource is a dynamic resource whose file suffix is not included in the ESA's default cacheable file list, ESA does not set a cache policy for such type of resource, and its cache status in the response is
DYNAMIC, this request will not be processed as a range request.After range requests are sent, the queries per second (QPS) of origin fetch increase. If the rate limiting feature is enabled on the origin server, requests sent to the origin server could be throttled. To prevent this issue, you can enable origin protection of ESA and add the IP addresses of origin fetch POPs of ESA to the IP address whitelist of the origin server.
Range chunk size
The chunk size can affect overall resource hit rates and the download speed of uncached resources. Therefore, adjust it according to your needs.
When Range requests are enabled, you can set the chunk size to 512 KB, 1 MB, 2 MB, or 4 MB. The default value is 512 KB. The following two scenarios illustrate the best practices:
With good network performance: If the origin fetch network between the ESA POP and the origin has low latency, it is recommended to use a smaller range chunk size. This helps ensure a higher download speed and improves cache hit rates.
With average network performance: If the origin fetch network has high latency (for example, in cross-border or long-distance downloads), a larger range chunk size is recommended. This may not provide optimal cache hit rates, but it will help improve download speeds.
Configure range requests
In the ESA console, choose Websites. In the Website column, click the target website.
In the left navigation pane, choose .
Click Create Rule and enter a Rule Name.
In the If requests match... section, set the request features to match. For more information about how to configure rules, see Rule expression components.
In the Range Requests section, click Configure. Select Match Client (Default), Disable, or Enable (Recommended If Large Files Requested).
If you select Match Client (Default) or Enable (Recommended If Large Files Requested), you can set the Shard Size parameter. Valid values: 512 KB, 1 MB, 2 MB, and 4 MB. Default value: 512 KB.
Origin Mode
Match Client (Default)
When a client sends a Range request to an ESA POP, the ESA POP forwards the request to the origin. For the first request for a resource that is redirected to the origin server, ESA rounds up the value of the Range header to the nearest integer, which is an integer multiple of the shard size in this case. For subsequent requests for the same resource, you can set the size of the Range header to the value of the Shard Size parameter.
Example: If the Shard Size parameter is set to 512 KB, a client sends a request that contains
Range:bytes=0-614399(600 KB) to an ESA POP. The ESA POP retrieves content that is 1,024 KB (the nearest integer rounded up from 600 KB) in size from the origin server for the first request and retrieves content that is 512 KB in size for subsequent requests.Disable
ESA POPs retrieve the entire file from the origin server regardless of whether the request carries the Range header. In such cases, the file distribution efficiency is lower than expected in large file distribution scenarios.
Example: A client sends a request that contains
Range:bytes=0-100to an ESA POP. The ESA POP redirects the request to the origin server without the Range header. The origin server returns the entire file to the ESA POP. The ESA POP caches the file while also serving the requested range specified byrange:0-100to the client.Enable (Recommended If Large Files Requested)
ESA POPs redirect client requests to the origin server with the Range header included, regardless of whether the requests contain the Range header. Every range request pulls content in the configured size, which is the value of the Shard Size parameter, from the origin server.
Example: N/A
Shard Size
This parameter is valid when the Origin Mode parameter is set to Match Client (Default) or Enable (Recommended If Large Files Requested). Valid values: 512 KB, 1 MB, 2 MB, and 4 MB. Default value: 512 KB.
Example: 1 MB.
Click OK.
References
Rule-related features vary in execution priority, rule behavior, and configuration scope. For more information, see How ESA rules take effect.