From 299c85b83f59f6e71b3e482b03f8f68b3eab7c91 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Andrej=20Rama=C5=A1euski?= <andrej@x2.cz>
Date: Thu, 15 Oct 2020 22:50:27 +0200
Subject: [PATCH] Zmena url callbacku, primy pristup k hls

---
 nginx.conf | 34 +++++++++++++++++++---------------
 1 file changed, 19 insertions(+), 15 deletions(-)

diff --git a/nginx.conf b/nginx.conf
index 1654221..1f7fb81 100644
--- a/nginx.conf
+++ b/nginx.conf
@@ -14,9 +14,10 @@ rtmp {
         application stream {
             live on;
 
-            on_publish http://pitube:3000/callback;
-            on_publish_done http://pitube:3000/callback;
-            on_update http://pitube:3000/callback;
+            on_publish http://pitube:3000/callback/rtmp;
+            on_publish http://pitube:3000/callback/rtmp;
+            on_publish_done http://pitube:3000/callback/rtmp;
+            on_update http://pitube:3000/callback/rtmp;
             notify_update_timeout 15s;
 
 #              -c:a libfdk_aac -b:a 128k -c:v libx264 -b:v 1000k -f flv -g 30 -r 30 -s 854x480 -preset superfast -profile:v baseline
@@ -63,19 +64,15 @@ http {
     server {
         listen ${HTTP_PORT};
 
-        location / {
-            proxy_pass http://pitube:3000/;
-            add_header Access-Control-Allow-Origin *;
-        }
-
         location /hls {
-          alias /tmp/hls;
-          types {
-              application/vnd.apple.mpegurl m3u8;
-              video/mp2t ts;
-          }
-          add_header Cache-Control no-cache;
-          add_header Access-Control-Allow-Origin *;
+            auth_request /callback/hls;
+            alias /tmp/hls;
+            types {
+                application/vnd.apple.mpegurl m3u8;
+                video/mp2t ts;
+            }
+            add_header Cache-Control no-cache;
+            add_header Access-Control-Allow-Origin *;
         }
 
         location /stat {
@@ -92,5 +89,12 @@ http {
             default_type text/xml;
             expires 24h;
         }
+
+        location / {
+            proxy_pass http://pitube:3000/;
+            add_header Access-Control-Allow-Origin *;
+            proxy_set_header X-Original-URI $request_uri;
+        }
+
     }
 }
-- 
GitLab