A simple Next.js reverse proxy that forwards requests to Backblaze B2's native download API. Serve B2 files from your own domain with the exact same URL path structure.
Live Demo: https://b2-reverse-proxy.vercel.app
- 🌐 Your Domain - Serve B2 files from your own domain
- ⚡ Simple Forwarding - Direct proxy to B2's native download API
- 🔄 Same URL Structure - Matches B2's
/file/bucket/pathformat exactly - 📦 Public Buckets - Works with public B2 buckets (no auth required)
- 🔒 Private Buckets - Supports private buckets via env credentials or URL token
- 🎯 Range Requests - Supports partial content / byte-range requests
- 🚀 Edge Ready - Deploy on Vercel's edge network
Just replace f005.backblazeb2.com with your domain:
# Original B2 URL
https://f005.backblazeb2.com/file/my-bucket/path/to/file.jpg
# Your Custom Domain
https://your-domain.com/file/my-bucket/path/to/file.jpgThat's it! No configuration needed for public buckets.
pnpm install
pnpm devTest it:
curl http://localhost:3000/file/your-bucket/your-file.jpgvercelOr connect your GitHub repo to Vercel for automatic deployments.
Set environment variables in .env.local (local) or Vercel dashboard (production):
# B2 download endpoint (default: https://f005.backblazeb2.com)
B2_DOWNLOAD_URL=https://f005.backblazeb2.com
# For private buckets: B2 credentials (optional)
# Get these from Backblaze B2 > App Keys
B2_KEY_ID=your_application_key_id
B2_APP_KEY=your_application_keyTwo ways to access private buckets:
Set B2_KEY_ID and B2_APP_KEY in your environment. The proxy will automatically generate and cache auth tokens (valid 24h, cached 23h).
# Just use the same URL - auth is handled automatically
curl https://your-domain.com/file/private-bucket/secret-file.pdfPass a B2 authorization token in the URL:
# Get a token from B2 API first, then:
curl "https://your-domain.com/file/private-bucket/secret-file.pdf?Authorization=YOUR_B2_TOKEN"Priority: URL token > Environment credentials > Public access
Endpoint: /file/[bucket]/[...path]
Methods: GET, HEAD
Query Parameters:
Authorization- B2 auth token (optional, for private buckets)
Request Headers Forwarded:
Range(for partial content requests)
Response Headers Forwarded:
Content-TypeContent-LengthContent-DispositionCache-ControlETagLast-ModifiedAccept-RangesContent-Range
# Public bucket
curl https://b2-reverse-proxy.vercel.app/file/my-public-bucket/image.jpg
# Private bucket (with env credentials configured)
curl https://b2-reverse-proxy.vercel.app/file/my-private-bucket/secret.pdf
# Private bucket (with URL token)
curl "https://b2-reverse-proxy.vercel.app/file/my-private-bucket/secret.pdf?Authorization=4_abc123..."
# Check file info
curl -I https://b2-reverse-proxy.vercel.app/file/my-bucket/file.jpgMIT