diff --git a/nginx.conf b/nginx.conf
index 16542219f7d297c3a631ab54f673256eea0605fe..1f7fb8148630e6bff6ebac9b85479ff8ce2f78ad 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;
+        }
+
     }
 }