Proxy

The proxy#

The proxy is a small stateless service that fetches a URL on the server's behalf and hands the response back with permissive CORS headers, so your browser can play a stream from a CDN that would otherwise refuse it.

It stores nothing, needs no database, and runs with an empty config file.

Do I need one?#

Only if you want your own. P-Stream ships with a shared one, and the extension replaces it entirely — if you use the extension, a proxy adds nothing.

The two reasons to run your own:

  • iOS. Extensions aren't available, so a proxy is the only way to get off the shared default.
  • A shared IP is a rate-limited IP. Streaming sites throttle by address. Your own instance is used by you alone.

Host it somewhere with a residential or plain VPS address. Cloudflare Workers, Netlify and the big serverless platforms have been abused enough that most streaming sites now block their whole IP ranges — the proxy will build and deploy fine there and then fail to fetch anything.

What it exposes#

RouteWhat it does
/Fetches ?destination=<url> and returns it with CORS headers
/streamSame, but rewrites HLS playlists so segments come back through it
/fragmentSegments, keys and init segments for a rewritten playlist
/cacheShort-lived cache of already-resolved stream URLs
/qualityShared "max quality seen" map, so the source picker can badge one
/health{ status, uptime }. ?bytes=N returns N bytes to measure throughput

Next: deploy it.