Links

Public link

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".

Direct link

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".

Link signing

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

ValueFormatExample
link [username].cdn.zerocdn.com/[signature]:[deadline]/[path_to_file] username.cdn.zerocdn.com/2c99cd801aebec2b63233323495722ae:1983122408/my/file.mp4
signaturemd5([path_to_file]-[ip]-[deadline]-[secret])md5('/my/file.mp4-127.0.0.1-1983122408-password') = 2c99cd801aebec2b63233323495722ae
deadlineYYYYMMDDHH2013122410

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.

ValueFormatExample
Cookie name[domain]-UID username-domain.com-UID
link[domain]/[signature]:[deadline]/[path_to_file] username-domain.com/14ffa7bc046f16e3c6c1b2a5459ee918:1983122408/my/file.mp4
signaturemd5([path_to_file]-[cookie-value]-[deadline]-[secret])md5('/my/file.mp4-c980d2b6-4ddb-4b35-8172-56ec427d2e75-1983122408-password') = 14ffa7bc046f16e3c6c1b2a5459ee918
deadlineYYYYMMDDHH2013122410

Attention! This function works only if White Label is connected (delegation of a custom domain to CDN servers).

Time limit

ValueFormatExample
link[username].cdn.zerocdn.com/[signature]:[deadline]/[path_to_file] username.cdn.zerocdn.com/4df70de26df93014d8c13962c88dee9c:1983122408/my/file.mp4
signaturemd5([path_to_file]--[deadline]-[secret])md5('/my/file.mp4--1983122408-password') = 4df70de26df93014d8c13962c88dee9c
deadlineYYYYMMDDHH2013122410

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.

ValueFormatExample
link[username].cdn.zerocdn.com/[path]/[signature]:[deadline]/[path_to_file] username.cdn.zerocdn.com/video/4df70de26df93014d8c13962c88dee9c:1983122408/file.mp4
signaturemd5([path]--[deadline]-[secret])md5('/video/--1983122408-password') = 4df70de26df93014d8c13962c88dee9c
deadlineYYYYMMDDHH2013122410

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

ValueFormatExample
linkzerocdn.com/[signature]/[deadline]/[id]/[name]zerocdn.com/62f68600ae7372948abeffdfa6c7262a/1983122408/1/file.flv
signaturemd5([id] - [name] - [ip] - [deadline] - [secret])md5('1-file.flv-127.0.0.1-1983122408-password') = 62f68600ae7372948abeffdfa6c7262a
deadlineYYYYMMDDHH2013122410

Time limit

ValueFormatExample
linkzerocdn.com/[signature]/[deadline]/[id]/[name]zerocdn.com/15e4d52ec88756013bfa52541efda569/1983122408/1/file.flv
signaturemd5([id]-[name]--[deadline]-[secret])md5('1--file.flv-1983122408-password') = 15e4d52ec88756013bfa52541efda569
deadlineYYYYMMDDHH2013122410