A public link points to a specific path in the repository. For example, if a file is located in the repository at /my/file, it will be available at http://cdnuser.cdn.zerocdn.com/my/file
- When you rename the file to "/my/file2" or move it, you will lose access to it using the old link, and the actual link will become "http://cdnuser.cdn.zerocdn.com/my/file2".
- If another file named "/my/file" is loaded into the repository, the contents of the new file will be available at the link "http://cdnuser.cdn.zerocdn.com/my/file".
A direct link is a link pointing to a file, regardless of its location in the repository and its name.
If the file is saved under the path "/my/file", a direct link to it may look like "http://cdn.zerocdn.com/0/file". If you rename it or move it to another folder, it will still be available at the link "http://cdn.zerocdn.com/0/file".
ZeroCDN provides the ability to restrict access to files by ip and by time or by cookie and time (only for public links). The following is to be done:
- To restrict file access:
- To set the "is_hidden" parameter for the file via the REST API;
- or the "Available only by signed link" option in the file properties in the web interface.
- To generate a signed link for the user.
Attention! The time is indicated in UTC+00:00.
Attention! You cannot use urlencoded file path to generate links.
Attention! To generate links to files with names containing non-Latin characters, the path to the file must be converted to utf-8 using the utf8_encode () function.
Attention! This restriction does not apply to authorized users who own the file. For them, the file is available both through an unsigned public link and through an incorrectly signed one.
Since ZeroCDN.com supports two types of links, the mechanism for generating signatures is different for them.
Signing public link
The public link signature is generated based on:
- file paths,
- ip or cookie of the user to whom the link is issued (ip or cookie is optional, if they are absent, the value is not checked),
- link expiration time (UTC + 00: 00 in YYYYMMDDHH format),
- api-key (the api-key can be viewed and set in the settings in the web user interface).
Time & IP restriction
Time and cookie limits
Allows you to generate a link associated with a specific user, regardless of his IP.
When generating a link, you need to set a unique cookie value, which will be checked on the CDN side.
The string of the format "[domain_name]-UID" is used as the name of the cookie-key.
Any value can be used as content: from the user id in the client system to a unique sequence of UID characters..
The cookie-key value is used instead of the IP when generating and validating the signature.
The lifetime of the cookie key must not be less than the lifetime of the link.
Attention! This function works only if White Label is connected (delegation of a custom domain to CDN servers).
Restriction by catalog
ZeroCDN.com provides the ability to restrict access not only to a single file, but to all files in a specific directory at once. This feature can be used, for example, for HLS.
The directory restriction can be used in conjunction with the cookie or ip restriction.
Signing direct links
The signature is generated based on:
- ip of the user to whom the link is issued (ip is optional, if it is absent, the user's address is not checked),
- link expiration time (UTC + 00: 00 in YYYYMMDDHH format)
- file id
- file name
- api-key (the api-key can be viewed and set in the settings in the web user interface)
Time & IP restriction
|signature||md5([id] - [name] - [ip] - [deadline] - [secret])||md5('1|