Serve private images
You can serve private images by using signed URL tokens. When an image requires a signed URL, the image cannot be accessed without a token unless it is being requested for a variant set to always allow public access.
- Log in to the Cloudflare dashboard and select your account.
- Select Images > Keys.
- Copy your key and use it to generate an expiring tokenized URL.
The example below uses a Worker that takes in a regular URL without a signed token and returns a tokenized URL that expires after one day. You can, however, set this expiration period to whatever you need, by changing the const EXPIRATION
value.