Updated on 2024-11-08 GMT+08:00

Range Requests

A range request allows the origin server to send data of a specific range to a CDN PoP based on the range information in the HTTP request header.

Background

  • Range information specifies the positions of the first and last bytes for the data to be returned. For example, Range: bytes=0-100 indicates that the first 101 bytes of the file are required.
  • If this function is enabled, when a client requests a resource that is not cached or has expired, CDN PoPs initiate a range request to pull the required resource from the origin server by segment and cache the resource.
  • Range requests shorten the distribution time of large files, improve origin pull efficiency, and reduce resource consumption.

Precautions

  • To enable range requests for origin pull, the origin server must support range requests, that is, requests with the Range field in the headers. Otherwise, origin pull may fail.
  • By default, range requests are enabled for file download acceleration and on-demand service acceleration.
  • If an origin server resource exceeds 1 GB and range requests are not enabled, origin pull for such resource will fail.
  • If the service type of your domain name is whole site acceleration, this function takes effect only for static resources.

Procedure

  1. Log in to Huawei Cloud console. Choose Service List > Content Delivery & Edge Computing > Content Delivery Network.

    The CDN console is displayed.

  2. In the navigation pane, choose Domains.
  3. In the domain list, click the target domain name or click Configure in the Operation column.
  4. Click the Origin Settings tab.
  5. In the Range Requests area, switch on or off Range Requests based on service requirements.
    Figure 1 Range requests

Example

Assume that you have enabled range requests for domain name www.example.com.

  • If user A requests www.example.com/cdn.mp4, and CDN PoPs do not cache the content or the cached content on the CDN PoPs has expired, the optimal CDN PoP initiates a range request to pull ranges of the content from the origin server. Ranges of the content are then cached on the PoP.
  • When user A's requested content is being cached, if user B sends a range request to this PoP, and the cache on the PoP already contains the range of the content requested by user B, the PoP immediately returns the requested range.