Prefetches content from origin servers to points of presence (POPs). This reduces loads on origin servers because users can directly hit cache upon their first visits.
Operation description
This operation supports POST requests in which parameters are sent as a form.
Related operations: RefreshObjectCaches and PushObjectCache
URL prefetch quota (daily): By default, each account can submit up to 1,000 URL prefetch tasks per day. If the daily peak bandwidth of your account exceeds 200 Mbps, you can submit a ticket to request a quota increase. Alibaba Cloud evaluates your business requirements and adjusts your quota accordingly.
Each Alibaba Cloud account can submit up to 100 URLs at a time.
Prefetch queue rules: Each account can have up to 100,000 URLs in the prefetch queue. Alibaba Cloud CDN prefetches content based on the order in which URLs are submitted. When the number of URLs in the prefetch queue reaches 100,000, Alibaba Cloud CDN rejects new prefetch tasks.
You can call this operation up to 50 times per second per account.
If you want to automate refresh or prefetch operations, see Refresh and prefetch batch script.
Limits
After a prefetch task is submitted and successfully executed, CDN POPs immediately retrieve the required resources from the origin server. Therefore, submitting many prefetch tasks generates many concurrent download tasks, which causes a sudden increase in back-to-origin bandwidth and requests, increasing the pressure on the origin server.
The time required to complete a prefetch task is proportional to the size of the files that you want to prefetch. In most cases, a prefetch task takes 5 to 30 minutes. A task that prefetches a smaller file requires less time to complete.
If you want to use a Resource Access Management (RAM) user to perform refresh or prefetch operations, you must first grant the required permissions to the RAM user. For more information, see Grant a RAM user the permissions to refresh and prefetch.
By default, prefetch requests include the Accept-Encoding:gzip header. If you want a prefetch request to include other headers or implement multi-replica prefetch, you can specify a custom prefetch header by configuring the WithHeader parameter.
During prefetching, if the origin server returns a status code related to redirection such as 307, the prefetch task will not follow the redirection address to complete the prefetch, which ultimately leads to prefetch failure. If the origin server returns a status code of 301 or 302, and CDN has enabled origin 301/302 follow, normal prefetching is not affected in this case.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
cdn:PushObjectCache |
none |
*Domain
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| ObjectPath |
string |
Yes |
The URL to prefetch. The format is accelerated domain name/file to prefetch. Note Separate multiple URLs with line feeds (\n) or (\r\n). The maximum length of each ObjectPath is 1,024 characters. |
example.com/image/1.png\nexample.org/image/2.png |
| Area |
string |
No |
The region from which content is prefetched. Valid values:
If you do not set this parameter, content in the acceleration region of your domain name is prefetched. Note If the acceleration region of your domain name is Global and you left this parameter empty, the content is prefetched globally. |
domestic |
| L2Preload |
boolean |
No |
Specifies whether to prefetch content to L2 points of presence (POPs). Valid values:
|
true |
| WithHeader |
string |
No |
By default, prefetch requests include the Accept-Encoding:gzip header. If you want a prefetch request to include other headers or implement multi-replica prefetch, you can specify a custom prefetch header by configuring the WithHeader parameter. The value must be in the JSON format. Note If you do not want to include the Accept-Encoding header during prefetching, submit the following:
|
{ "Accept-Encoding": [ "gzip, deflate, br" ] } |
| QueryHashkey |
boolean |
No |
Specifies whether to enable the hash key query mode when you run a prefetch task. Valid values:
|
true |
| ConsistencyHash |
boolean |
No |
If the acceleration region of the domain name is Chinese mainland and HASH origin fetch is enabled, you can use this parameter to set HASH prefetching to converge regional origin fetch traffic and reduce origin fetch bandwidth generated by prefetching.
Important This parameter is valid only for domain names with Chinese mainland as the acceleration region. |
true |
Response parameters
|
Parameter |
Type |
Description |
Example |
|
object |
|
||
| PushTaskId |
string |
The ID of the prefetch task. If multiple tasks are returned, the IDs are separated by commas (,). The task IDs are merged based on the following rules:
|
9524xxxx |
| RequestId |
string |
The ID of the request. |
16A96B9A-F203-4EC5-8E43-CB92E68F4CD8 |
Examples
Success response
JSON format
{
"PushTaskId": "9524xxxx",
"RequestId": "16A96B9A-F203-4EC5-8E43-CB92E68F4CD8"
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | SingleRequest.OverLimit | A maximum of 1000 URLs are supported for each request. | |
| 400 | QuotaExceeded.Preload | Your preload attempts have exceeded the daily limit. | The maximum number of URL prefetches on the current day is exceeded. |
| 400 | InvalidObjectPath.Malformed | The specified ObjectPath is invalid. | |
| 400 | InvalidExtensiveDomain.ValueNotSupported | The specified ExtensiveDomain is not supported. | |
| 400 | PreloadQueueFull | The warming queue is full,please try again later. | |
| 400 | QuotaPerMinuteExceeded.Refresh | You have exceeded the prescribed preload limits per minute. | |
| 400 | InvalidObjectPath.ExceedsMaximum | The maximum number of urls is exceeded. | The number of submitted URLs exceeds the maximum limit. |
| 400 | InvalidCustomHeader | Parse preload header failed. | Custom header parsing error. |
| 429 | TooManyRequests | System load fluctuates, please try again later. | System load fluctuates, please try again later. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.