Most teams keep their original images in object storage: Amazon S3, Cloudflare R2, Google Cloud Storage, Azure Blob Storage, or an S3-compatible store such as MinIO, Wasabi or Backblaze B2. And most security reviews end with the same rule: the bucket is not public. That rule is right. A public bucket lets anyone list or download the full-resolution originals, including the ones that were never meant to be published, and every download is billed to you as egress.

Until recently, the usual way to put an image CDN in front of a private bucket was to build a small proxy: a service with the bucket credentials that receives unsigned requests and makes signed ones. That proxy is another public endpoint to run, patch, scale and secure, and it has to be reachable from every point of presence the CDN has. This article explains how ZawCloud Images reads from a private bucket directly, and how to set it up so the credentials you hand over can do as little as possible.

How it works

You give the console a read-only credential for the bucket once, on the Domains tab under Origin → Add a private bucket. From then on, every edge node signs each fetch it makes from that bucket itself, using the provider's own scheme:

ProviderSigned withCredential to create
Amazon S3AWS Signature V4, in the bucket's regionAn IAM key allowed s3:GetObject on arn:aws:s3:::bucket/*
S3-compatible (MinIO, Wasabi, B2…)Signature V4, with your endpointA read-only key for the one bucket
Cloudflare R2Signature V4, region autoAn API token with Object Read only, limited to the bucket
Google Cloud StorageSignature V4 via the XML APIAn HMAC key for a service account with Storage Object Viewer
Azure Blob StorageShared KeyThe storage account name and one of its keys

Nothing in front of the bucket changes, and nothing needs to be made public. The delivery URL looks exactly as it did before:

https://a3f9c21b.zwcld.net/v1/catalogue/2026/sofa-grey.jpg?w=1200&q=auto

The path after /v1/ is the object key, under an optional folder you set when you add the bucket. The node signs a GET for that one object, transforms it and caches the rendition. Conditional requests still work: when a cached entry expires, the node revalidates it with If-None-Match or If-Modified-Since, so an unchanged object is not downloaded again.

Give it as little as possible

The credential should be able to read objects in one bucket and do nothing else. Specifically:

  • S3. Grant s3:GetObject on the bucket's objects only. Note that without s3:ListBucket, S3 answers a missing object with 403 rather than 404. The node passes that through with a message that says to check both the credentials and whether the object exists. Adding ListBucket makes missing files clearer in the logs, at the cost of letting the key list keys. Most teams leave it off.
  • R2. An API token scoped to Object Read only on the one bucket.
  • Google Cloud Storage. A dedicated service account with Storage Object Viewer on the bucket, and an HMAC key for it.
  • Azure. Shared Key is per storage account, not per container, so the key can read every container in that account. Put your images in a storage account of their own. SAS tokens and Entra ID are not supported yet.

Where the secret goes

A credential you hand to a third party should be easy to reason about. This one is stored, moved and used like this:

  • At rest, the secret is encrypted with the platform's data protection keys, the same way TLS private keys are. The console never shows it again after you save it. To change it, you enter a new one.
  • Edge nodes never hold a database connection or the encryption keys. A node asks the internal control plane for one bucket's credentials, naming both the account and the bucket, and keeps the answer in memory for one minute. It is never written to disk or to the shared cache.
  • Rotation is routine. Use Replace credentials on the bucket, wait a minute for nodes to pick up the new key, then revoke the old one in your provider.

Isolation between accounts

Two rules keep one customer's bucket from ever serving another customer's request.

First, credentials are looked up by account and bucket id together. Even a stale or hand-edited configuration cannot make a node sign with somebody else's key.

Second, renditions are cached under the bucket's internal id, not under its address. Two accounts could both name the same bucket while only one holds credentials that can read it. If the cache were keyed by address, the second account would be served whatever the first had fetched. Keying by id makes each cache entry private to the account that owns the bucket row. For the same reason, a bucket's location cannot be edited after it is created: to point somewhere else, add a new bucket and switch the origin to it.

Mixing private and public origins

A bucket is not a separate kind of account. It is something an origin setting points at. The account has an origin, and each custom hostname can override it, so one account can serve:

img.example.com      → a private R2 bucket (product photography)
static.example.com   → https://www.example.com/assets/ (public site assets)
docs.example.com     → a private S3 bucket, folder docs/images

Up to ten buckets per account. Purges follow the same rules: a purge of products/* clears that account's entries for its own bucket, and nobody else's.

Why this is cheaper as well as safer

Storage providers bill per request and per gigabyte of egress. With a public bucket behind a CDN, a cache miss on any size of any image becomes a bucket read. Here, the edge caches each rendition and revalidates rather than re-downloads, and identical misses that arrive at the same moment are collapsed into one fetch. A page with forty thumbnails of the same new image reads it from the bucket once, not forty times.

You can tighten this further with permitted output sizes or presets only on the Limits tab. Then nobody can generate new bucket reads by inventing widths, because a size you do not publish is refused before the bucket is contacted.

Setting it up, end to end

  1. In your provider, create the read-only credential described above.
  2. In the console, open Domains → Origin → Add a private bucket, choose the provider, and enter the bucket, region or endpoint, optional folder and the credential. Leave Make it this account's origin ticked if it is your only origin.
  3. Request an object through your platform hostname, for example https://a3f9c21b.zwcld.net/v1/path/to/object.jpg?w=400. A 403 from the bucket comes back with the reason, so a wrong region or a key without read access is obvious.
  4. Keep the bucket private, and check that its public access settings stay off.

Each provider has its own walkthrough, with the exact policy to paste: Amazon S3 and S3-compatible, Cloudflare R2, Google Cloud Storage and Azure Blob Storage. If you are moving from a service that stored your originals for you, this is also where those exported originals go. See Leaving imgix, Cloudinary or Thumbor without rewriting a URL.