From d753d1d977d7d6298ba2f8d7d5550d6f731f4ef1 Mon Sep 17 00:00:00 2001 From: Tony Miller Date: Sat, 20 Feb 2021 10:03:12 +0900 Subject: [PATCH] serve HLS from liquidsoap The directory needs to be docker vol mounted to be accessible. --- nginx.conf | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/nginx.conf b/nginx.conf index f48f8d9..b850778 100644 --- a/nginx.conf +++ b/nginx.conf @@ -92,6 +92,32 @@ http { root /tmp; add_header Cache-Control no-cache; } + location /liquidsoap { +# Serve HLS fragments + +# CORS setup + add_header 'Access-Control-Allow-Origin' '*' always; + add_header 'Access-Control-Expose-Headers' 'Content-Length'; + +# allow CORS preflight requests + if ($request_method = 'OPTIONS') { + add_header 'Access-Control-Allow-Origin' '*'; + add_header 'Access-Control-Max-Age' 1728000; + add_header 'Content-Type' 'text/plain charset=UTF-8'; + add_header 'Content-Length' 0; + return 204; + } + + + types { + application/vnd.apple.mpegurl m3u8; + video/mp2t ts; + } + # this should be mounted as volume with docker image + root /tmp/liquidsoap; + add_header Cache-Control no-cache; + } + } }