Decision 0002 Superseded
Superseded by 0008 Serve images from the bucket's custom domain.
- Owner
- justin
- Reviewed
- 2026-10-08
Context
Product images are in R2 (see Product images). Browsers need a URL for each one. R2 can serve a bucket publicly, on its r2.dev subdomain or a custom domain, or a Worker can read the object and return it.
Decision
storefront-api serves images at GET /images/<key>. The bucket stays private.
Consequences
- One hostname for the whole shop while we are still on workers.dev, and nothing to set up in DNS.
- Only keys under
products/are reachable, whatever else ends up in the bucket. - Every image request runs the Worker, even though the response is the same for a year. That is fine at launch traffic. If image requests start to dominate the Worker's requests, move them to a custom domain on the bucket.