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
- Try sample: Play
- Advanced diagnostics: Resolution / Segments / Audio track
- 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.
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.