Cloudflare Worker–based IPTV proxy for streaming HLS channels with automatic playlist rewriting and CORS support.
- Proxy IPTV HLS streams (
.m3u8) - Automatic playlist URL rewriting
- Segment streaming support (
.ts,.m4s, etc.) - Dynamic headers (User-Agent, Referer, Origin)
- CORS enabled (
Access-Control-Allow-Origin: *) - Lightweight and fast (Cloudflare Workers)
worker.js
README.md
The Worker:
- Reads the channel ID from the URL path
- Matches it against the
CHANNELSobject - Proxies the request to the real IPTV source
- Rewrites
.m3u8playlists to pass back through your Worker - Streams video segments directly
Open worker.js and locate:
// IPTV Channels
const CHANNELS = {
"2342": "https://live.livetvstream.co.uk/LS-63503-4",
// "1001": "https://example.com/live/stream1"
}To add a new IPTV stream:
- Find the base stream URL Example:
https://live.livetvstream.co.uk/LS-63503-4/index.m3u8
- Remove
/index.m3u8Keep only the base path:
https://live.livetvstream.co.uk/LS-63503-4
- Add it to
CHANNELS:
const CHANNELS = {
"2342": "https://live.livetvstream.co.uk/LS-63503-4",
"1001": "https://example.com/live/channel"
}After deploying your Worker, access streams like this:
https://workername.username.workers.dev/{id}/index.m3u8
If your Worker URL is:
https://tv-proxy.frank.workers.dev
And your channel ID is:
2342
Stream URL:
https://tv-proxy.frank.workers.dev/2342/index.m3u8
npm install -g wranglerwrangler loginwrangler deployAfter deployment, Cloudflare will provide:
https://your-worker-name.your-username.workers.dev
Source:
https://live.livetvstream.co.uk/LS-63503-4/index.m3u8
Worker config:
"2342": "https://live.livetvstream.co.uk/LS-63503-4",Worker stream URL:
https://workername.username.workers.dev/2342/index.m3u8
- Only use streams you have permission to proxy.
- Some IPTV providers may block proxy usage.
- Adjust cache settings if needed.
- Ensure the base URL does NOT include
index.m3u8.