Prefetching files to CDN servers
To prefetch content from origins to CDN servers:
-
In the management console
, select the folder where your resource is located. -
Select Cloud CDN.
-
Click the resource name.
-
Go to the Content tab.
-
In the top-right corner, click
and choose Preload content. -
Enter the file names in the File path field.
-
Click Preload content.
If you do not have the Yandex Cloud command line interface yet, install and initialize it.
The folder specified in the CLI profile is used by default. You can specify a different folder using the --folder-name
or --folder-id
parameter.
-
View the description of the CLI update resource command:
yc cdn resource update --help
-
Get a list of all resources in the default folder:
yc cdn resource list --format yaml
Result:
id: s0me1dkfjq******** folder_id: s0mef01der7p******** cname: testexample.com created_at: "2022-01-19T09:23:57.921365Z" updated_at: "2022-01-19T10:55:30.305141Z" active: true options: edge_cache_settings: enabled: true default value: "345600" cache_http_headers: enabled: true value: - content-type - content-length - connection - server - date - test stale: enabled: true value: - error - updating allowed_http_methods: value: - GET - POST - HEAD - OPTIONS origin_group_id: "89783" origin_group_name: My origins group origin_protocol: HTTP ssl_certificate: type: DONT_USE status: READY
-
Specify the paths to the files you would like to prefetch as a comma-separated list with no spaces:
yc cdn cache prefetch --resource-id <resource_ID> \ --path <file_paths>
For more information about the
yc cdn cache prefetch
command, see the CLI reference.
Use the prefetch REST API method for the Cache resource or the CacheService/Prefetch gRPC API call.