Skip to content

Proxy & edge secrets

The proxy reads its configuration from NITRO_* environment variables, set on the edge host (Netlify / Cloudflare), never in any client bundle. See The CORS proxy for deployment.

VariableDefaultDescription
NITRO_PROXY_SECRET– (open mode)The HMAC secret. Must equal the backend’s PROXY_SECRET. When unset, the proxy runs in open mode (no signature required) — local dev only, never production.
NITRO_DEFAULT_UAa browser UAFallback User-Agent when a signed link doesn’t specify one.
GET /?u=<upstream url>&r=<referer>&o=<origin>&ua=<user-agent>&s=<signature>

GET / with no u is a health check. The signature is hex(HMAC-SHA256(secret, "<url>\n<referer>\n<origin>\n<user-agent>"))[:32] — kept byte-for-byte identical to the backend’s /sign grant. Only u and s are required.

If you deliver Jellyfin via the edge (JELLYFIN_EDGE_INJECT=on on the backend), the proxy logs into your Jellyfin server itself and injects the token on each upstream fetch — stripping it from playlists so it’s never browser-visible.

VariableDescription
NITRO_JELLYFIN_URLBase URL of your Jellyfin server (also the host the edge injects for). Must be internet-reachable; the SSRF guard rejects private/LAN IPs, so use a public hostname.
NITRO_JELLYFIN_USERNAME / NITRO_JELLYFIN_PASSWORDCredentials the edge authenticates with (token cached, re-auth on 401).
NITRO_JELLYFIN_TOKENOptional pre-minted token, skipping username/password.

Set these on both edges if you run two. Unset ⇒ the feature self-disables and Jellyfin stays fully on the backend.

The proxy is a Nitro app; build it for your target edge:

CommandTarget
pnpm build:cloudflareCloudflare Workers
pnpm build:netlifyNetlify Edge
pnpm build:nodeA plain Node server (self-host the relay)
  • Signed-only in production: forged/unsigned links get 401, so it’s never an open relay.
  • SSRF guard: refuses private/loopback hosts and non-HTTP(S) schemes.
  • HLS-aware: rewrites playlist sub-resources, re-signing them with the same secret.
  • Header-only sources only for plain relaying: a source whose token is bound to the resolving machine’s IP/ASN can’t be served from a datacenter edge — those route to the extension (E3) or the backend instead.