Skip to content
Hussh
Connect MCP

Media CDN Offload Pipeline

Architecture and design for offloading large public media assets to Cloud Storage and Cloud CDN.

Concept

TL;DR: To scale video playback and bypass Next.js streaming ceilings, public video and audio assets over 32MiB are offloaded to Google Cloud Storage and cached globally via Cloud CDN, with strict path gating to protect private Fund A materials.

Status as of 2026-07-22: see body.

Relations

Architectural Overview

Serving large video and audio content through a Next.js/Cloud Run app server hits a structural ceiling: standard non-Range GET requests past ~32 MiB buffer the entire response, causing HTTP 500 errors in the runtime.

To resolve this limitation while preserving extreme visual fidelity for Hussh's cinematic assets, the platform implements a decoupled static offloading pipeline. Large media assets are stored on a public Google Cloud Storage (GCS) origin bucket and routed globally through an external HTTPS Load Balancer integrated with Google Cloud CDN.

Decoupled Routing & Delivery

The delivery mechanism is designed as a transparent, side-effect-free origin swap handled at the application middleware level:

  1. In-Memory Request Proxying: The Next.js request proxy intercepts all inbound requests targeting the /media/ path.
  2. Dynamic Origin Swap: If the MEDIA_CDN_ORIGIN environment variable is configured, the proxy performs a 307 Temporary Redirect to the edge CDN endpoint.
  3. Range and Seek Support: The redirected request preserves the incoming Range headers, enabling seamless seeking and low-latency chunked playbacks across all mobile and desktop viewports.
  4. Local Fallback: If the environment variable is unset, media assets continue to serve locally from /public/media/—rendering the entire mechanism reversible with a single configuration flag.

Compliance and Security Boundaries

The media offloading pipeline operates under strict compliance constraints:

  • Strict Gating: Gated investor materials (such as Fund A masterclasses or restricted briefing films) are structurally prohibited from sitting on public origins.
  • Fallback and Enforcement: The proxy middleware rejects offload requests for any gated paths, forcing those files to serve through the authenticated Next.js app server behind qualified-investor checks.
  • Build-Time Verification: A localized drift-guard test suite pins the sync manifest directly to the authoritative gating logic, ensuring that developer modifications to the gate do not result in unintended public exposure.

Sources