kaltura / nginx-vod-module

NGINX-based MP4 Repackager
GNU Affero General Public License v3.0
2k stars 439 forks source link

multi url structure not working #1175

Open bharatdevparmar opened 4 years ago

bharatdevparmar commented 4 years ago

nginx.config

worker_processes  auto;

events {
    use epoll;
}

http {
    log_format  main  '$remote_addr $remote_user [$time_local] "$request" '
        '$status "$http_referer" "$http_user_agent"';

    access_log  /dev/stdout  main;
    error_log   stderr debug;

    default_type  application/octet-stream;
    include       /usr/local/nginx/conf/mime.types;

    tcp_nodelay on;

    open_file_cache          max=1000 inactive=5m;
    open_file_cache_valid    2m;
    open_file_cache_min_uses 1;
    open_file_cache_errors   on;

    aio on;

    server {
        listen 80;
        server_name localhost;

        vod_mode remote;
        vod_upstream_location /remote;

        vod_metadata_cache                 metadata_cache 256m;
        vod_response_cache response_cache  512m;
        vod_last_modified_types            *;
        vod_segment_duration               3000;
        vod_align_segments_to_key_frames   on;
        vod_dash_fragment_file_name_prefix "segment";
        vod_hls_segment_file_name_prefix   "segment";

        vod_dash_absolute_manifest_urls    off;
        vod_hls_absolute_master_urls       off;
        vod_hls_absolute_index_urls        off;

        vod_manifest_segment_durations_mode accurate;

        # gzip manifests
        gzip on;
        gzip_types application/vnd.apple.mpegurl application/x-mpegURL video/f4m application/dash+xml text/xml;

        location ^~ /remote/hls/ {
            rewrite ^/remote/hls/(.*) /$1 break;
            proxy_pass https://highlevel-staging.appspot.com.storage.googleapis.com;
        }

                location /hls/ {
            vod hls;
            add_header Access-Control-Allow-Headers '*';
            add_header Access-Control-Allow-Origin '*';
            add_header Access-Control-Allow-Methods 'GET, HEAD, OPTIONS';
        }

        location ^~ /remote/dash/ {
            rewrite ^/remote/dash/(.*) /$1 break;
            proxy_pass https://highlevel-staging.appspot.com.storage.googleapis.com;
        }

        location /dash/ {
            vod dash;
            add_header Access-Control-Allow-Headers '*';
            add_header Access-Control-Allow-Origin '*';
            add_header Access-Control-Allow-Methods 'GET, HEAD, OPTIONS';
        }

        location / {
            return 200 'OK!';
            add_header Content-Type text/plain;
        }
    }
}

When request /hls/member/L1RdR5kw1BGYwMJFN5gB/videos/6efcdce0-2e75-46b0-abf5-4d4d810e62e3,6efcdce0-2e75-46b0-abf5-4d4d810e62e3,.mp4.urlset/master.m3u8

it's give bellow error

rewritten data: "/member/L1RdR5kw1BGYwMJFN5gB/videos/6efcdce0-2e75-46b0-abf5-4d4d810e62e36efcdce0-2e75-46b0-abf5-4d4d810e62e3.mp4", args: "", client: 127.0.0.1, server: localhost, request: "GET /hls/member/L1RdR5kw1BGYwMJFN5gB/videos/6efcdce0-2e75-46b0-abf5-4d4d810e62e3,6efcdce0-2e75-46b0-abf5-4d4d810e62e3,.mp4.urlset/master.m3u8 HTTP/1.1", subrequest: "/remote/hls/member/L1RdR5kw1BGYwMJFN5gB/videos/6efcdce0-2e75-46b0-abf5-4d4d810e62e36efcdce0-2e75-46b0-abf5-4d4d810e62e3.mp4", host: "<mydomain>"

ngx_child_request_wev_handler: upstream returned a bad status 404 while sending to client, client: 127.0.0.1, server: localhost, request: "GET /hls/member/L1RdR5kw1BGYwMJFN5gB/videos/6efcdce0-2e75-46b0-abf5-4d4d810e62e3,6efcdce0-2e75-46b0-abf5-4d4d810e62e3,.mp4.urlset/master.m3u8 HTTP/1.1", host: "<mydomain>"

It's working perfect with single url /hls/member/L1RdR5kw1BGYwMJFN5gB/videos/6efcdce0-2e75-46b0-abf5-4d4d810e62e3.mp4/master.m3u8

erankor commented 4 years ago

Your URL is wrong, you are missing a comma after /videos/

bharatdevparmar commented 4 years ago

@erankor You mean I need to add , after /videos/, I've tried still not work.

erankor commented 4 years ago

Other than the missing comma, you also have the same file name twice (6efcdce0-2e75-46b0-abf5-4d4d810e62e3.mp4), it doesn't make sense with a single file...