7.13. Secure Link for files in storage
Attention!
Only for files, not for directories.The Secure Link technology allows the use of secure links to files. Such links contain secret key and can be IP-restricted, time-restricted, or unrestricted. Using Secure Link, you can organize flexible secure access to files in your storage.
Secure link structure
Example of a link:
https://example.cdn.express/secure/ip/t/XXxXXxxXXXXXXXXXXXxxXx/1234567890/path/to/file
Each secure link consists of several parts:
- Type of access restriction:
secure/ip/t— by IP address and lifetime.secure/ip— by IP address only.secure/t— by lifetime onlysecure— no restrictions.
- An encoded hash of the data set of the secret key, path, and access restriction options.
- End of life time tag (if used).
- Path to the file in storage.
Secret key
Important points:
- Only one key can be in effect at a time.
- When refreshing the key, all links with the old key will stop working.
- The key cannot be disabled or deleted — you can simply refresh it and not use it for link creation.
Secret key is generated on the "Secure Link" tab:
You can also refresh it there.
Secure Link generator
Notes:
- When using IP address restrictions, the link is generated for your current IP address.
- To generate links, you can use the special method in storage API.
The form is intended for test generation of Secure Link with different access restriction options:
You can specify the path to the required file from the storage root, the lifetime in seconds, the type of access restriction and click "Generate". The output will be a ready link that can be copied to clipboard and used for testing.
Examples of ready to use code
Examples of ready PHP code for Secure Link generation with different access restriction options can be used as a basis for your own scripts. The storage address and secret key are already present in the code, all you need to do is specify the path to the required file in the storage, optionally the visitor's IP address and lifetime, and the output will be a secure link.
Commentaires