6.15. Secure Link for files in storage

Attention!

Only for files, not for directories.

Technology Secure Link allows you to use secure links to files. These links contain The secret key and can be with access restriction by IP address, by duration or without restrictions. Using Secure Link, you can organize flexible secure access to files in your storage.

Tools for working with Secure Link are located on the storage settings tab.

Link example:

https://XXxxxxXxXXXXxxXX.cdn.express/secure-link/ip-ttl/XxxXXXxxXX_XXXxXXXxXXx/1234567890/path/to/file

Each secure link consists of several parts:

  • Storage host address or connected domain.
  • Prefix secure-link.
  • Access restriction type:
    • ip-ttl — by IP address and lifetime.
    • ip — only by IP address.
    • ttl — only in lifetime.
    • static — no limits.
  • Encoded hash of the dataset secret key, path and access restriction options.
  • End-of-life label (if used).
  • The path to the file in the repository.

Important points:

  • Only one key can be active at a time.
  • Updating or deleting a key disables all links generated with it.

The secret key is generated on the storage settings tab:

You can also update or delete it there.

When using IP address restriction, the link is generated for your current IP address.

The form is intended for test generation of Secure Link with different options for restricting access:

You can specify the path to the desired file from the storage root, the lifetime in seconds, the type of access restriction and click «Generate». The output will be a ready-made link that can be copied to the clipboard and used for the test.

Examples of ready—made PHP code for generating a Secure Link with different options for restricting access can be taken as a basis for use in your scripts. The storage address and secret key are already present in the code, you just need to specify the path to the desired file in the storage, optionally — the visitor's IP address and lifetime, and get a ready—made secure link as the output.

Content