HLS cross-origin access

A page on tools.kitpip.com needs permission to fetch a playlist on another origin. The permission must cover the master playlist, media playlists, initialization data and every segment. Configure your own media server to return Access-Control-Allow-Origin, including on error responses. Byte-range downloads also need exposed Content-Range. Changing player code cannot grant permission on someone else’s server.

Example

Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: Content-Range, Content-Length
Accept-Ranges: bytes

# Range requests must return 206 and a valid Content-Range.

How it works

  1. Try sample: Play
  2. Advanced diagnostics: Resolution / Segments / Audio track
  3. Export report: JSON

Expected result

Compare Allowed HLS, Missing CORS, HTTP 403 and HTTP 404 in the test kit. Only responses allowing CORS expose HTTP details to browser code. Apply headers to playlists, segments and error responses.

Example · ZIP

Required CORS response headers for HLS origins and CDNs

Browsers send an Origin: https://tools.kitpip.com request header for playlists, initialization segments (#EXT-X-MAP), media segments, and error responses. All of them must explicitly allow cross-origin reads—especially HTTP 4xx responses when debugging failures.

# Nginx location block for .m3u8 playlists & .ts / .m4s segments
location ~* \.(m3u8|ts|m4s|mp4)$ {
  add_header Access-Control-Allow-Origin "*" always;
  add_header Access-Control-Allow-Methods "GET, HEAD, OPTIONS" always;
  add_header Access-Control-Expose-Headers "Content-Length, Content-Range" always;
  if ($request_method = OPTIONS) {
    return 204;
  }
}

Cloudflare, S3 & Apache notes

On Amazon S3 or Cloudflare R2, configure a bucket CORS rule allowing AllowedOrigins (["*"] or specific player origins), AllowedMethods (["GET", "HEAD"]), and ExposeHeaders (["Content-Range", "Content-Length"]). If CDN caching is active, include Origin in Vary or configure consistent wildcard headers so cached responses do not strip Access-Control-Allow-Origin.

Validation

JSON · Validation

Privacy

Local videos and subtitles stay on this device. Online playback contacts the media provider directly. URLs and progress are saved only when you enable history; clear them on shared devices.

Download limits

Merge completed, unencrypted H.264/AAC streams into MP4 without re-encoding. TS and fMP4 are supported. All playlists and segments must allow cross-origin access. Maximum input: 128 MiB per task. Available memory may impose a lower limit.

Guides

hls.js / ffmpeg.wasm