Broadcast Fixes // StreamRelay Lab
Caddy & Nginx Reverse Proxy Headers for LL-HLS & WHEP
Web players (hls.js, Video.js, Shaka) fail silently on cross-origin manifests unless your reverse proxy strips stale .m3u8 caches and sets clean CORS headers.
Measured MediaMTX & FFmpeg Telemetry
Never cache .m3u8 playlists at the proxy or CDN layer; meanwhile, immutable .m4s/.ts segments can carry short 10-second Cache-Control headers so micro-bursts hit edge memory.
| Subsystem / Signal | Measured Target | Operational Impact |
|---|---|---|
| Playlist (.m3u8) Cache | no-cache, no-store | Prevents players looping stale 3 segments |
| Segment (.m4s/.ts) Cache | public, max-age=10 | Safe for live edge micro-caching |
| CORS Header | Access-Control-Allow-Origin * | Required for embedded hls.js players |
Step-by-Step Triage & Config Remediation
- Proxy :443 to MediaMTX :8888: Route /live/* HLS paths over HTTP/2 TLS to 127.0.0.1:8888.
- Set strict no-cache on manifests: Ensure .m3u8 responses never cache, especially for 200ms LL-HLS part requests.
- Expose WHEP POST endpoint: Route /whep/* to 127.0.0.1:8889 while keeping UDP :8189 open directly.
# Caddyfile snippet for MediaMTX LL-HLS + WHEP signaling
stream.example.com {
handle /live/*/whep* {
reverse_proxy 127.0.0.1:8889
}
handle {
reverse_proxy 127.0.0.1:8888
}
}
Diagnostic FAQ
Does MediaMTX already send CORS headers?
MediaMTX includes configurable hlsAllowOrigins and webrtcAllowOrigins; keep proxy CORS rules aligned so headers are never duplicated.
Can Nginx handle 3,000 concurrent LL-HLS connections?
Yes, with worker_rlimit_nofile 65535 and keepalive_requests 10000, Nginx or Caddy handles 3,000+ TLS streams easily.