๐บ HLS Proxy Worker
September 4, 2025 ยท View on GitHub
A Cloudflare Worker that helps you fetch and rewrite HLS (.m3u8) playlists.
It is useful when IPTV or streaming links donโt play directly, because some providers require special headers like Origin and Referer.
With this worker you can:
- Proxy
.m3u8playlists through Cloudflare. - Automatically rewrite relative paths into full URLs.
- Add custom headers (Origin, Referer, User-Agent) when needed.
- Use it for IPTV, testing, or custom media apps.
๐ What You Need
- A free Cloudflare account (includes 100,000 requests per day).
- (Optional) Reqable โ to capture request headers.
๐ง Setup Instructions (No Wrangler Needed)
- Sign in to Cloudflare Dashboard.
- Go to Workers & Pages โ Create Application โ Create Worker.
- Delete the default code and copy-paste the contents of
index.jsfrom this repo. - Click Deploy.
Your worker will be live at something like:
https://hls-proxy-worker.username.workers.dev/?url=YOUR_M3U8_LINK
๐ฏ Usage
Pass a url query parameter:
https://your-worker-domain/?url=https://example.com/live/playlist.m3u8
The worker will return a valid .m3u8 file you can open in VLC, IPTV players, or media apps.
๐ When Do You Need Origin & Referer?
Some streaming providers block direct requests unless they come from a specific website.
Example: a stream only works when opened on example.com, but fails in your IPTV app.
Thatโs when you add a rule in the worker:
const rules = {
"example.com": {
Origin: "https://example.com",
Referer: "https://example.com/",
},
};
With this, your worker will send the correct headers and bypass the restriction.
๐ต๏ธ How to Find Headers with Reqable
If you donโt know which headers are needed:
-
Install Reqable.
-
Open the stream in your browser or app while Reqable is running.
-
Find the request to the
.m3u8file. -
Look at the Request Headers.
- If you see
OriginorReferer, copy them.
- If you see
-
Add them to the
rulesin your worker.
Example from Reqable:
Origin: https://example.com
Referer: https://example.com/
Paste these into your worker code.
๐ Notes
- Free Cloudflare Workers have 100,000 requests/day.
- For higher limits, upgrade to a paid plan.
- This project is for educational & personal use.
โญ Support
If you find this project useful, please give it a star โญ on GitHub โ it helps others discover it and keeps the project alive.
Please respect the streaming providersโ terms of service.