# r2-proxy A tiny Cloudflare Worker that serves the oversize archive zips stored in R2 on a free `*.workers.dev` subdomain — no custom domain required. It adds edge caching and per-client rate limiting (both free-tier) on top of the bucket. **One Worker serves every export site.** Archive objects are keyed by site id (`/archives/.zip`), so this is a pure passthrough — deploy it **once** for the whole instance, not per site. ## Deploy ```sh # 1. Set bucket_name in wrangler.toml to the bucket you use in the editor's # "Archive overflow storage" setting (and tune the rate limit if you like). cd r2-proxy pnpm install # first time only pnpm run deploy # wrangler deploy — reuses your host wrangler auth ``` Then set the editor's **Settings → Archive overflow public URL** to the deployed `https://..workers.dev` URL. Full setup and the alternative custom-domain path are documented in [../PUBLISH.md](../PUBLISH.md#securing-downloads-against-cost-abuse). ## Scripts - `pnpm run deploy` — deploy to `workers.dev` - `pnpm run dev` — run locally with `wrangler dev` - `pnpm run typecheck` — `tsc --noEmit` This project is intentionally **outside** the pnpm workspace (it has its own `node_modules`) so its Cloudflare Worker types don't leak into the apps' typecheck.