Sick of having to deal with those annoying CORS issues when you try to stream your M3U8/HLS files? Let oxycors handle the headache—seamless streaming starts here! 🎥✨
Here's a lightweight Next.js-based CORS proxy for HLS manifests, segments, YouTube livestreams, and more.
Try out oxycors directly in Google Colab—no setup required! This notebook runs the oxycors server using "npm run dev" and provides a publically accessible link to use.
-
Clone the repo
git clone https://github.com/shrkwy/oxycors.git cd oxycors -
Install dependencies
npm install # or yarn install -
Run locally ; Before starting, set your environment variables (see Environment Variables).
npm run dev # or yarn dev(By default PORT: 6028)Browse 👉 http://localhost:6028 to test the proxy interface (
src/app/page.tsx).
Available Endpoints
/api/proxy/manifest/api/proxy/segment/api/proxy/youtube
URL Parameters
url(required) — the original resource URL to proxy (HLS manifest, segment, static file, or YouTube link).
Tip: URL‑encode to prevent incompatibility issues.
For example, to proxy this HLS manifest:
https://example.com/live/stream.m3u8
-
(Optional) URL‑encode:
https%3A%2F%2Fexample.com%2Flive%2Fstream.m3u8 -
Request via manifest endpoint:
https://your-domain.com/api/proxy/manifest?url=https%3A%2F%2Fexample.com%2Flive%2Fstream.m3u8 -
Load into your HLS player (HLS.js example):
const hls = new Hls(); hls.loadSource('https://your-domain.com/api/proxy/manifest?url=...'); hls.attachMedia(videoElement);
| Endpoint | Parameters | Purpose | Mechanism |
|---|---|---|---|
/api/proxy/manifest |
url |
Provide HLS manifest with proxied elements | • Fetches the HLS manifest from the provided URL |
| • Parses & rewrites segment and sub‑manifest URLs to route through the proxy | |||
| • Returns the modified manifest | |||
/api/proxy/segment |
url |
Proxy segments & static files | • Fetches media segments (.ts, .m4s) or static resources (.jpg, .css, .mp4, etc.) |
| • Pipes data directly to the client via proxy | |||
/api/proxy/youtube |
url |
Proxy YouTube livestreams | • Extracts live YouTube stream’s HLS manifest |
| • Proxies the manifest and media segments using the above endpoints | |||
| • Will only work if all the functions are handled by the same server |
The homepage (
/) demo interface (src/app/page.tsx) lets you test your proxy server live.
-
NEXT_PUBLIC_URLRECOMMENDEDDeclare your Host / Public URL of hosted instance. (e.g.https://my-oxycors-app.service.app). -
ALLOWED_ORIGINSRECOMMENDEDJSON array of allowed origins. Do mention your app origin to prevent abuse. If undeclared, all origins are allowed access.["https://example1.app", "https://example2.app"]
NEXT_PUBLIC_URL=https://my-oxycors-app.service.app
ALLOWED_ORIGINS=["https://example1.app", "https://example2.app"]Love it? 🧡 Found a bug? 🐞 PRs and feature requests are welcome!
- Fork 🔀
- Branch 🌱
- Commit 📂
- PR 🔍
Feel free to contribute in any manner!
© 2025 oxycors — backend with Next.js, and built for frictionless streaming. 🎉
