← Zurück zu Web-App-Entwickler
Entdecke, wie der Skill hilft
2.
Private Medienauslieferung
Liefert private Medien effizient aus, ohne Zugriffsentscheidungen durch gemeinsame Caches oder wiederverwendbare Links auszuhebeln.
cdn-private-media-delivery
Teammitglieder mit diesem Skill
Wann ist der Skill hilfreich?
Nutze ihn bei geschützten Bildern, Videos oder Downloads über CDN beziehungsweise zeitlich begrenzte Links.
Wobei hilft er dir?
- Trennt öffentliche Dateien, private Medien und widerrufbare Freigaben.
- Verhindert benutzerübergreifendes Caching von Berechtigungsweiterleitungen.
- Koordiniert signierten Zugriff, Ablaufzeit und Teilbereichsanfragen.
Das könntest du fragen
Plane private Videoauslieferung ohne Weiterleitungslecks zwischen Kunden. Rufe das Video als zwei Kunden ab und widerrufe eine Freigabe. Cache-Antworten dürfen weder den Widerruf umgehen noch fremde Links offenlegen.
Ausführliche Dokumentation
Hier findest du die ursprüngliche Anleitung, Beispiele und Prüfschritte des Skills in ihrer Originalsprache.
Weniger anzeigen
CDN & Private Media Delivery
Delivering media and files fast without leaking private tenant data requires aligning storage keys, Cache-Control headers, CDN signing and application share-link tokens with the file's exact access model.
1. Classify Assets by Access Model First
Never put private user uploads in a public bucket "just to make CDN caching easier":
- Truly Public Assets (marketing images, public product catalog photos, public avatars where policy explicitly states they are world-readable):
- Serve via CDN with immutable content-addressed or versioned keys (
avatars/{id}.{hash}.webp) andCache-Control: public, max-age=31536000, immutable.
- Serve via CDN with immutable content-addressed or versioned keys (
- Authenticated Tenant / User Files (project attachments, private media, invoices, exports):
- Bucket remains 100% private.
- Authorize every access request in application code first, then deliver via one of two patterns:
- Short-lived CDN / Object-Store Signed URL (CloudFront Signed URL, Cloudflare R2/Workers signed token, S3 Presigned GET, GCS/Azure SAS) with a short TTL (
60–900seconds). - Signed Cookies scoped to a path prefix (e.g., CloudFront Signed Cookies scoped to
tenants/{tenant_id}/videos/{video_id}/*): essential for HLS/DASH video streaming, where a video player requests hundreds of.m3u8and.ts/.m4ssegment URLs and signing every segment URL individually in the manifest is brittle.
- Short-lived CDN / Object-Store Signed URL (CloudFront Signed URL, Cloudflare R2/Workers signed token, S3 Presigned GET, GCS/Azure SAS) with a short TTL (
- Revocable External Share Links (
/s/{share_token}):- Do not hand out a 7-day S3 presigned URL directly as a user-facing "Share Link" if the product allows revoking share links, password-protecting links or tracking download counts!
- Instead, issue an application share URL (
/s/{high_entropy_token}) backed by afile_sharestable (id,file_id,token_hash,expires_at,revoked_at,max_downloads,download_count,password_hash). - When a visitor hits
/s/{token}, validate that the share is not revoked/expired and the parent file is not deleted, then redirect (302withCache-Control: private, no-store) to a 60-second signed storage URL.
2. Cache-Control & Vary Discipline
- Authorization-check endpoints (
/api/files/{id}/download,/s/{token}): must always returnCache-Control: private, no-storeso shared proxies or CDNs never cache User A's redirect for User B. - Signed immutable derivative objects: once authorized via a signed CDN URL, the underlying immutable derivative (
thumb_256_v1.webp) can be cached at the CDN edge (s-maxage) while requiring a valid signature on every edge request. - Range & CORS headers on CDN: forward
Range/Originheaders when serving video/audio or canvas/WebGL textures across origins, and includeVary: Origin, Rangeso partial byte responses are cached properly. - Never log signed URLs or share tokens in plaintext access logs or analytics beacons (
Refererheader leakage — setReferrer-Policy: no-referreron download/share pages).
Enthaltene Dateien 1
SKILL.md
