Cloudflare R2 Storage Test

Using R2 for Static Assets

This image is being served from Cloudflare R2 storage:

Astroflare

How R2 Integration Works

Configuration

R2 bucket is configured in wrangler.toml with the binding name STORAGE.

API Route

An Astro API route handles requests to /storage/* paths and serves files from R2.

Asset Usage

Reference assets using the /storage/ path prefix in your HTML or Astro components.

<img src="/storage/images/astroflare.jpg" alt="Astroflare" />

Uploading Files

Use the upload utility to add files to your R2 bucket:

npm run upload-to-r2 path/to/local/file images/destination.jpg -- --remote