From aeaf88685560527c6ec5eca21f1a1a987991af7c Mon Sep 17 00:00:00 2001 From: Gabe Kangas Date: Sun, 31 Oct 2021 19:20:56 -0700 Subject: [PATCH] Force the content type on hls playlists --- controllers/hls.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/controllers/hls.go b/controllers/hls.go index 1cdb4e837..41cbb550c 100644 --- a/controllers/hls.go +++ b/controllers/hls.go @@ -38,6 +38,9 @@ func HandleHLSRequest(w http.ResponseWriter, r *http.Request) { // Playlists should never be cached. middleware.DisableCache(w) + // Force the correct content type + w.Header().Set("Content-Type", "application/x-mpegURL") + // Use this as an opportunity to mark this viewer as active. id := utils.GenerateClientIDFromRequest(r) core.SetViewerIDActive(id) @@ -45,6 +48,7 @@ func HandleHLSRequest(w http.ResponseWriter, r *http.Request) { cacheTime := utils.GetCacheDurationSecondsForPath(relativePath) w.Header().Set("Cache-Control", "public, max-age="+strconv.Itoa(cacheTime)) } + middleware.EnableCors(w) http.ServeFile(w, r, fullPath) }