Rebasely Beta: data may be purged

examples/storefront Public

Markdown · 23 lines · 944 B · at 94db762

---id: 0002-serve-images-through-the-apitype: decisionowner: justinstatus: supersededsuperseded-by: 0008-images-from-the-bucket-domainreviewed: 2026-10-08---# 0002 Serve images through storefront-api## ContextProduct 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.## Decisionstorefront-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.