A sovereign, globally distributed CDN powered by Cloudflare Workers and R2 object storage. 15+ intelligent proxy routes, on-the-fly ImageXR processing, GraphQL POST caching, SRI computation, and privacy-first Google Fonts proxying.
Modern web applications depend on dozens of external CDN services — npm packages from jsDelivr, fonts from Google, icons from Iconify. Each dependency introduces latency, reliability risk, and GDPR exposure (user IPs sent to third parties).
OrzattyCloud CDN aggregates these under a single sovereign endpoint: cdn.orzatty.com. Rather than re-hosting terabytes of packages, it acts as a smart proxy that caches aggressively at Cloudflare's edge, normalizes latency, shields user IPs from upstream CDNs, and extends upstream capabilities with features like ImageXR, GraphQL caching, and SRI computation.
| Component | Technology | Role |
|---|---|---|
| Compute | Cloudflare Workers (V8) | Request routing, proxy logic, cache control |
| Object Storage | Cloudflare R2 | Proprietary assets, ImageXR source images |
| Database | Cloudflare D1 (SQLite) | Package metadata, analytics aggregates |
| Image Processing | Cloudflare Image Resizing | On-the-fly resize, WebP/AVIF conversion |
| API Backend | Vercel (Node.js) | Complex operations at /api/v2/pulse |
| Cache Layer | Cloudflare Cache API + Tags | Edge caching with selective invalidation |
| WAF | Cloudflare WAF Rules | Hotlink protection, bot mitigation |
The pattern cdn.orzatty.com/{route}/... dispatches to the appropriate upstream CDN. Each route has a dedicated proxy function with custom headers and cache strategy:
Every proxied response is enriched with Orzatty headers regardless of upstream origin:
X-Powered-By: OrzattyCloud CDN v1.0
X-Request-ID: <uuid-per-request>
Access-Control-Allow-Origin: *
CDN-Cache-Control: public, max-age=<ttl>
Vary: Accept-Encoding
Cache TTL is calibrated to content immutability. Versioned assets (npm, jsDelivr) get maximum caching; live content gets minimal:
| Route | TTL | Rationale |
|---|---|---|
/npm/@{ver}/, /gh/{sha}/ | 1 Year | Content-addressed — immutable by definition |
/gstatic/fonts/ | 1 Year | Google font files never change at a given URL |
/iconify/{set}/ | 7 Days | Icon sets are versioned but not strictly immutable |
/fonts/css2 | 24 Hours | Font CSS may change for variable fonts |
/unpkg/ (latest), /api/packages/search | 5 Minutes | Latest tag may update; searches must stay fresh |
/api/graphql (POST) | 60 Seconds | Balance freshness vs. GraphQL origin load |
/raw-storage/*.m3u8 | 5 Seconds | HLS live playlist — must not be stale |
/raw-storage/*.ts | 1 Hour | HLS segments are immutable once written |
Tags enable surgical invalidation — purging only specific packages without touching the entire cache:
Cache-Tag: pkg-{packageName}, all-assets, meta-{packageName}, cdnjs-{libName}
ImageXR dynamically transforms images stored in R2 using Cloudflare's native Image Resizing — no separate processing server required:
// Request: serve from R2, resize to 800px wide, convert to WebP
GET /imagexr/hero-banner.jpg?w=800&format=webp&quality=85
// Processing (inside the Worker):
// 1. Parse params → width:800, format:webp, quality:85
// 2. Fetch source from R2: env.orzatty_cdn_storage.get('hero-banner.jpg')
// 3. Apply Cloudflare Image Resizing via cf.image:{width,format,quality}
// 4. Return: Content-Type:image/webp | Cache-Control:public,max-age=86400
Supported transforms: ?w= width, ?h= height, ?format=webp|avif|jpeg|png, ?quality=1-100. First request ~50–200ms; subsequent requests from edge cache <10ms.
Standard HTTP caches cannot cache POST requests. OrzattyCloud CDN implements a custom strategy: a SHA-256 hash of URL + request body is used as the edge cache key, enabling cache hits for any identical GraphQL query:
const cacheKey = `${request.url}::${await sha256(body)}`;
// On MISS → fetch origin, store with:
// Cache-Control: public, max-age=60
// X-Orzatty-Graph-Cache: MISS
// On HIT → serve from edge with:
// X-Orzatty-Graph-Cache: HIT
Subresource Integrity allows browsers to verify CDN assets have not been tampered with. The /api/sri/ endpoint computes SHA-256 hashes on demand:
GET /api/sri/?resource=npm/jquery@3.7.1/dist/jquery.min.js
{
"url": "https://cdn.orzatty.com/npm/jquery@3.7.1/dist/jquery.min.js",
"integrity": "sha256-gnr1Efy+vZOhEHCg/SHPPZjEjW//+dIb/2Wn/1cjsvo=",
"cached": false
}
// Usage in HTML:
<script src="https://cdn.orzatty.com/npm/jquery@3.7.1/dist/jquery.min.js"
integrity="sha256-gnr1Efy+..."
crossorigin="anonymous"></script>
GDPR concern: requesting fonts directly from fonts.googleapis.com exposes user IPs to Google. OrzattyCloud CDN proxies both the CSS and the binary font files, rewriting all URLs in the CSS to point to cdn.orzatty.com/gstatic/... — the browser never makes a direct request to Google.
// Google's CSS references:
src: url(https://fonts.gstatic.com/s/inter/v12/UcCO3FwrK3iLT...woff2)
// OrzattyCloud CDN rewrites to:
src: url(https://cdn.orzatty.com/gstatic/s/inter/v12/UcCO3FwrK3iLT...woff2)
Cloudflare R2 is S3-compatible, egress-free, and accessible from Workers with sub-millisecond latency. The serveRawR2() function implements HTTP 304 conditional requests, avoiding retransmitting unchanged files:
const object = await env.orzatty_cdn_storage.get(key, {
onlyIf: {
etagMatches: request.headers.get('If-None-Match'),
}
});
// If object.body === null → return 304 (not modified)
// Otherwise → stream body with ETag + Cache-Control
/api/v2/pulse and invalidation endpoints require bearer tokenctx.waitUntil() — zero latency impact on responses