Access-Control-Allow-Origin

HLS CORS Error: Why M3U8 Streams Fail in the Browser

An HLS CORS error happens when a browser is not allowed to fetch the M3U8 manifest, encryption key, or media segments from another origin. The stream may still play in VLC because CORS is a browser rule, not a media rule. To test the stream online, use a CORS-enabled origin or route the HLS requests through a proxy.

Last updated: June 20, 2026

智能 CORS 代理

遇到跨域失败时可通过 Cloudflare Worker 代理 manifest、key 和切片。

Video preview

链接健康度体检

解析全部分辨率轨道、统计码率与分片时长,并抽样检测分片死链。死链检测受浏览器跨域限制, 建议先开启 CORS 代理以获得准确结果。

How to recognize the CORS failure

CheckSymptomMeaning
Manifest blockedThe .m3u8 request fails before playback starts.The origin needs Access-Control-Allow-Origin or the player needs a proxy.
Key blockedThe manifest loads, but encrypted playback fails.The AES-128 key URL must also allow CORS or route through the same proxy.
Segments blockedPlayback starts, then buffers or stalls.Every .ts or .m4s segment request needs the same CORS path.
VLC works, browser failsDesktop playback works but web playback does not.This usually confirms a browser CORS problem, not a broken stream.
Preflight failsCustom headers trigger an OPTIONS request that the origin rejects.Avoid unnecessary headers or configure the proxy/origin to handle OPTIONS.

How to fix or test an HLS CORS error

  1. 1

    Check whether the manifest loads

    Open the M3U8 URL or paste it into the player. If the manifest request is blocked by CORS, playback cannot even start.

  2. 2

    Compare with VLC

    If VLC can play the same URL but the browser cannot, the stream is probably reachable and the failure is browser access control.

  3. 3

    Enable the smart CORS proxy

    Turn on the proxy so manifests, encryption keys, and media segments all travel through a response that the browser can read.

  4. 4

    Run the health report

    Use the validator through the proxy to check whether segments are actually alive instead of just blocked by CORS.

  5. 5

    Add Referer only when needed

    If the origin uses hotlink protection, set the original page URL as Referer. Do not add custom headers unless the origin requires them.

Why HLS needs CORS on more than one URL

An HLS player does not fetch only one file. It fetches a master manifest, one or more media playlists, encryption keys for AES-128 streams, and many segment URLs. A single missing CORS header on any of those resources can break playback, so testing only the first .m3u8 response is not enough.

What Access-Control-Allow-Origin should do

For public streams, the origin can send Access-Control-Allow-Origin for the site hosting the player, or use a wildcard when credentials are not involved. For private streams, keep the origin locked down and use a controlled proxy endpoint for testing. Avoid mixing direct and proxied URLs in the same HLS session.

Why a proxy is useful for debugging

A proxy lets the browser request HLS assets from your own allowed origin while the proxy fetches the real manifest, key, and segment URLs. That makes it possible to tell whether a stream is broken or merely blocked by browser policy. It also gives you one place to add Referer or User-Agent when the origin requires them.

Frequently asked questions

What causes an HLS CORS error?

An HLS CORS error occurs when the browser cannot read the M3U8 manifest, encryption key, or media segments because the origin did not allow cross-origin access. VLC can still play the stream because CORS is enforced by browsers.

Why does my M3U8 stream play in VLC but not Chrome?

VLC is not restricted by browser CORS checks. If VLC works and Chrome fails, the stream is usually reachable, but the browser cannot read one or more HLS requests without CORS headers or a proxy.

Can a CORS proxy fix M3U8 playback?

Yes, for testing and debugging. The proxy must route the manifest, media playlists, keys, and segments so every HLS request comes from an origin the browser is allowed to read.

Do HLS segments need CORS headers?

Yes. The manifest, child playlists, keys, and every media segment need to be readable by the browser. A stream can fail even if the top-level .m3u8 file has correct CORS headers.

Is this the same as hotlink protection?

No. CORS is a browser access rule. Hotlink protection is an origin rule that may require a specific Referer or User-Agent. Some streams have both problems, so you may need a proxy plus a matching Referer.