Cloudflare 中文文档
Cloudflare Image Optimization
编辑这个页面
跳转官方原文档
Set theme to dark (⇧+D)

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.

  1. Log in to the Cloudflare dashboard and select your account.
  2. Select Images > Keys.
  3. 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.