From d00d5d3390004f29f2be96a370a1ac5a0015cc20 Mon Sep 17 00:00:00 2001 From: Gabe Kangas Date: Wed, 17 Jun 2020 21:02:16 -0700 Subject: [PATCH] Disallow caching of hls playlists client-side --- main.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/main.go b/main.go index e485c6353..ddf0717cc 100644 --- a/main.go +++ b/main.go @@ -63,6 +63,7 @@ func startChatServer() { if path.Ext(r.URL.Path) == ".m3u8" { clientID := getClientIDFromRequest(r) stats.SetClientActive(clientID) + disableCache(&w) } }) @@ -77,6 +78,11 @@ func enableCors(w *http.ResponseWriter) { (*w).Header().Set("Access-Control-Allow-Origin", "*") } +func disableCache(w *http.ResponseWriter) { + (*w).Header().Set("Cache-Control", "no-cache, no-store, must-revalidate") + (*w).Header().Set("Expires", "0") +} + func getStatus(w http.ResponseWriter, r *http.Request) { enableCors(&w)