Skip to content
ArticleBeginner

Securely access and upload assets with Cloudflare R2

Create a TypeScript Worker that securely serves files from and uploads files to a Cloudflare R2 bucket.

Last updated
Oct 12, 2026
Read the original

R2 stores large amounts of unstructured data without egress fees. This tutorial binds a bucket to a Worker, serves files from it, and adds an upload route that only accepts requests with an Authorization header matching your secret.

What you’ll learn

  • Create an R2 bucket and bind it to a Worker
  • Fetch objects from the bucket
  • Upload securely with an authorization check
  • Deploy

Cloudflare products used

R2, Workers.

Follow the full, step-by-step tutorial in Cloudflare’s documentation.

Keep learning