From 2d28d7e2271dedffad4ac7fd32e4e705b89e8d30 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Diemer?= <stephane.diemer@ubicast.eu>
Date: Tue, 29 May 2018 09:51:30 +0200
Subject: [PATCH] Added streaming block in CM vhost (refs #25331).

---
 2.Common_services/5.Nginx/vhost_skyreach.conf | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/2.Common_services/5.Nginx/vhost_skyreach.conf b/2.Common_services/5.Nginx/vhost_skyreach.conf
index d6f32eba..b8daaa02 100644
--- a/2.Common_services/5.Nginx/vhost_skyreach.conf
+++ b/2.Common_services/5.Nginx/vhost_skyreach.conf
@@ -45,6 +45,22 @@ server {
 		proxy_read_timeout 12h;
 	}
 
+	location /streaming/ {
+		# check requested path, only m3u8 and ts are allowed
+		# ?: means that the group should not be stored as variable
+		location ~ ^/streaming/([\d\.\:]+)/((?:.+)\.(?:m3u8|ts)(?:\?.+)*)$ {
+			proxy_pass https://$1/$2;
+			proxy_cache livecache;
+			# do not consider secure urls as new files
+			proxy_cache_key $scheme$proxy_host$uri;
+			# only one request at a time will be allowed to populate a new cache element
+			proxy_cache_lock on;
+			# show if playlist or fragment has been cached from wowza
+			add_header X-Cache $upstream_cache_status;
+			# wowza is defining expiration headers (m3u8 is 1s, ts is 3600)
+		}
+	}
+
 	location / {
 		uwsgi_pass unix:///home/skyreach/.skyreach/uwsgi.sock;
 		include /etc/nginx/uwsgi_params;
-- 
GitLab