6.14. 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.
Protected link structure
Link example:
https://XXxxxxXxXXXXxxXX.cdn.express/secure/ip/t/XxxXXXxxXX_XXXxXXXxXXx/1234567890/path/to/file
Each secure link consists of several parts:
- Storage host address or connected domain.
- Access restriction type:
secure/ip/t
— by IP address and lifetime.secure/ip
— only by IP address.secure/t
— only in lifetime.secure
— 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.
The secret key
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 tab «Secure Link»:
You can also update or delete it there.
Secure Link Generator
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.
Ready code examples
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.