2020-11-12 11:41:52 +01:00
|
|
|
location /ospAuth {
|
|
|
|
internal;
|
|
|
|
|
|
|
|
set $channelID "";
|
|
|
|
|
|
|
|
if ($request_uri ~* /videos/(.+)/(.+)) {
|
|
|
|
set $channelID $1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($request_uri ~* /videos/(.*)/clips/(.*)\.(.+)) {
|
|
|
|
set $channelID $1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($request_uri ~* /stream-thumb/(.*)\.(.+)) {
|
|
|
|
set $channelID $1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($request_uri ~* /live-adapt/(.*)\.m3u8) {
|
|
|
|
set $channelID $1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($request_uri ~* /live-adapt/(.*)_(.*)/(.*)\.(.*)) {
|
|
|
|
set $channelID $1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($request_uri ~* /live/(.+)/(.+)) {
|
|
|
|
set $channelID $1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($request_uri ~* /edge/(.+)/(.+)) {
|
|
|
|
set $channelID $1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($request_uri ~* /edge-adapt/(.*)\.m3u8) {
|
|
|
|
set $channelID $1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($request_uri ~* /edge-adapt/(.*)_(.*)/(.*)\.(.*)) {
|
|
|
|
set $channelID $1;
|
|
|
|
}
|
|
|
|
|
|
|
|
proxy_pass http://socket_nodes/auth;
|
|
|
|
proxy_pass_request_body off;
|
|
|
|
proxy_set_header Content-Length "";
|
|
|
|
proxy_set_header X-Original-URI $request_uri;
|
|
|
|
proxy_set_header X-Channel-ID $channelID;
|
|
|
|
proxy_cache auth_cache;
|
|
|
|
proxy_cache_key "$cookie_ospSession$http_x_auth_token$channelID";
|
|
|
|
proxy_cache_valid 200 10m;
|
|
|
|
proxy_ignore_headers Set-Cookie;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
location /videos {
|
|
|
|
auth_request /ospAuth;
|
|
|
|
alias {{ osp_http_path }}/videos;
|
|
|
|
}
|
|
|
|
|
|
|
|
location /videos/temp {
|
|
|
|
alias {{ osp_http_path }}/videos/temp;
|
|
|
|
}
|
|
|
|
|
|
|
|
location /stream-thumb {
|
|
|
|
auth_request /ospAuth;
|
|
|
|
alias {{ osp_http_path }}/stream-thumb;
|
|
|
|
}
|
|
|
|
|
|
|
|
location /live-adapt {
|
|
|
|
auth_request /ospAuth;
|
|
|
|
alias {{ osp_http_path }}/live-adapt;
|
|
|
|
}
|
|
|
|
|
|
|
|
location /live {
|
|
|
|
auth_request /ospAuth;
|
|
|
|
alias {{osp_http_path}}/live;
|
|
|
|
}
|
|
|
|
|
|
|
|
location /static {
|
2020-11-12 22:02:15 +01:00
|
|
|
alias /opt/osp/static;
|
2020-11-12 11:41:52 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
location ~ /images(.*) {
|
|
|
|
# Disable cache
|
|
|
|
add_header Cache-Control no-cache;
|
|
|
|
|
|
|
|
# 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;
|
|
|
|
}
|
|
|
|
|
|
|
|
root {{ osp_http_path }};
|
|
|
|
}
|
|
|
|
|
|
|
|
location /edge {
|
|
|
|
auth_request /ospAuth;
|
2021-01-28 02:08:06 +01:00
|
|
|
rewrite ^/edge/(.*)$ $scheme://$ospedge_node/edge/$1 redirect;
|
2020-11-12 11:41:52 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
location /edge-adapt {
|
|
|
|
auth_request /ospAuth;
|
2021-01-28 02:08:06 +01:00
|
|
|
rewrite ^/edge-adapt/(.*)$ $scheme://$ospedge_node/edge-adapt/$1 redirect;
|
2020-11-12 11:41:52 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
location /http-bind/ { # BOSH XMPP-HTTP
|
2020-11-12 17:19:04 +01:00
|
|
|
proxy_pass http://127.0.0.1:5280/bosh/;
|
2020-11-12 11:41:52 +01:00
|
|
|
proxy_set_header Host $host;
|
2020-11-12 17:19:04 +01:00
|
|
|
proxy_set_header X-Real-IP $remote_addr;
|
|
|
|
proxy_set_header X-Forwarded-for $proxy_add_x_forwarded_for;
|
2020-11-12 11:41:52 +01:00
|
|
|
proxy_redirect off;
|
|
|
|
proxy_buffering off;
|
|
|
|
proxy_read_timeout 65s;
|
|
|
|
proxy_send_timeout 65s;
|
|
|
|
keepalive_timeout 65s;
|
|
|
|
tcp_nodelay on;
|
|
|
|
}
|