Secure URLs of images by adding security token to URLs
Securing image URLs can add an extra layer of security. It helps to prevent unauthorized access of your image URL.
We use 'MD5' hash function on original URL and secure token to generate the signature. This signature needs to pass with unsigned URL with parameter
s to make signed URL. If the URL is altered or missing the
s parameter , we will respond with
403 - Forbidden status.
By default this feature is disabled for any source. You can enable it by following steps.
- Go to sources page, edit the source which you would like to enable secure URL.
- Click on security tab.
- Toggle 'Secure URLs' button and click save.
Your secure token will be appear bellow this option and you can use it to sign URL.
Please read this
Enabling secure URLs for existing source will lead to 403 errors on all URLs unless all requests are signed. Please use this carefully and don't enable it unless you know what you are doing.
We uses 'MD5' a cryptographic hash function to sign the image URL. Your secure token, image URL and query parameters will be input to this function. The output of this hash function will be appended to the end of your unsigned URL with
Here is the sample Nodejs code to sign any URL.
You can take reference of this code and implement URL signing in language of your choice. We will soon publish examples of URL signing in different languages.
URLs can be given an expiration date via an
expires parameter that takes a UNIX timestamp in the query parameters like
Any request after this timestamp, will 403 - expired. We set remaining time of expiration as max-age in cache-control header for valid requests.
Please include expires as query parameters while signing the URL.