D1, R2 & Resend · Free guide

When a file is too big for GitHub or Cloudflare Pages: using R2 cleanly

Cloudflare Pages enforces a strict 25 MiB cap per individual static asset and 20,000 total files per deployment, while GitHub warns at 50 MB and blocks files over 100 MB. Anytime your website distributes videos, large ZIP kits, software installers, or 50+ high-res PDFs, host those payloads in Cloudflare R2 and link them cleanly.

By StaticLaunch · Four Media Group LLC

Know the exact repository and deployment ceilings early

Small business websites rarely approach 20,000 HTML pages, yet a single uncompressed promotional MP4 or 40 MB catalog PDF immediately breaks Cloudflare Pages deployments.

  • GitHub hard per-file block: 100 MB.
  • Cloudflare Pages single asset ceiling: 25 MiB.
  • Cloudflare Pages deployment file ceiling: 20,000 files.

Compress site imagery first, offload bulk downloads second

Convert inline hero photography to crisp WebP under 250 KB directly inside public/images/, and upload genuinely multi-megabyte assets to R2 buckets mapped cleanly to downloads.yourdomain.com.

Set proper Content-Disposition headers for direct downloads

Configure file metadata in R2 cleanly so clicking a brochure or ZIP downloads reliably with clean filenames instead of opening garbled browser text tabs.

Common questions

Should I use Git LFS for large website PDFs?

Usually no—uploading directly to R2 on a custom subdomain avoids Git LFS quota complexity while delivering assets directly over Cloudflare's edge network.

How much free R2 storage is included to start?

Check Cloudflare's live R2 pricing page for current free monthly storage/operations allowances—standard informational PDFs and press packs typically cost pennies or $0.

References

Provider interfaces and limits can change. Consult the original documentation before changing production settings.