diff --git a/2.Common_services/5.Nginx/vhost_cache.conf b/2.Common_services/5.Nginx/vhost_cache.conf index 3eeff0f98860cd8c8a900ff1126d86b553fd2f4d..6076aad9fe3458e1255a4e87d3319f9d787a3a93 100644 --- a/2.Common_services/5.Nginx/vhost_cache.conf +++ b/2.Common_services/5.Nginx/vhost_cache.conf @@ -14,55 +14,18 @@ server { } location /streaming/ { - # Live - location ~ \.m3u8$ { - rewrite ^/(.*)$ /$1? break; - proxy_pass {{ source_server }}; - proxy_cache uc-cache; - # 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; - # serve from cache while updating - proxy_cache_use_stale updating; - # ignore upstream headers - # http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_cache_valid - proxy_ignore_headers "Cache-Control" "X-Accel-Expires" "Expires"; - # hide upstream X-Cache header - proxy_hide_header X-Cache; - # add own X-Cache header - add_header X-Cache $upstream_cache_status; - - # m3u8-specific - # how long should the data be kept in this cache - proxy_cache_valid 200 2s; - # instruct browsers never to cache m3u8 - expires -1; - } - location ~ \.ts$ { - rewrite ^/(.*)$ /$1? break; - proxy_pass {{ source_server }}; - proxy_cache uc-cache; - # 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; - # serve from cache while updating - proxy_cache_use_stale updating; - # ignore upstream headers - # http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_cache_valid - proxy_ignore_headers "Cache-Control" "X-Accel-Expires" "Expires"; - # hide upstream X-Cache header - proxy_hide_header X-Cache; - # add own X-Cache header - add_header X-Cache $upstream_cache_status; - - # ts-specific - # how long should the data be kept in this cache - proxy_cache_valid 200 10s; - # instruct browsers to cache this for 6s - expires 6s; - } + # Live; expiration headers are defined by upstream (nginx/wowza) + rewrite ^/(.*)$ /$1? break; + proxy_pass {{ source_server }}; + proxy_cache uc-cache; + # 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; + # hide upstream X-Cache header + proxy_hide_header X-Cache; + # add own X-Cache header + add_header X-Cache $upstream_cache_status; } location /resources/ { # VOD