kaltura / nginx-vod-module

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

ngx_child_request_wev_handler: unexpected, output buffer is null #1525

Closed comiconomenclaturist closed 5 months ago

comiconomenclaturist commented 5 months ago

I've compiled nginx with the nginx-vod-module and nginx-aws-auth-module. My nginx.conf contains:

http {
    gzip on;
    gzip_vary on;
    gzip_types application/vnd.apple.mpegurl;

    aws_auth $aws_token {
        access_key AKIAXXXXXXXXXXXXX;
        secret_key XXXXXXXXXXXXXXXX;
        service s3;
        region eu-west-2;
    }

    aws_auth_presign $aws_presigned $aws_token https://my_bucket.s3.eu-west-2.amazonaws.com/$key_name?X-Amz-Expires=600;

    server {
        server_name _;
        allow all;

        vod_mode remote;
        vod_upstream_location /redirect;
        vod_last_modified_types *;

        location /proxy/ {
            internal;
            proxy_pass https://my_bucket.s3.eu-west-2.amazonaws.com/;
            proxy_set_header X-Amz-Date $aws_auth_date;
            proxy_set_header X-Amz-Content-SHA256 e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855; # no body
            proxy_set_header Authorization $aws_token;
        }

        location ~ /redirect/(?P<key_name>.*) {
            return 307 $aws_presigned;
        }

        location /content/ {
            vod hls;
        add_header Access-Control-Allow-Headers '*';
            add_header Access-Control-Expose-Headers 'Server,range,Content-Length,Content-Range';
            add_header Access-Control-Allow-Methods 'GET, HEAD, OPTIONS';
            add_header Access-Control-Allow-Origin '*';
            expires 100d;
        }
}

The URL I am using to try and get the HLS manifest is:

http://localhost/content/s3path/file.mp4/master.m3u8

and the error I'm getting is Bad Gateway 502:

2024/05/30 12:15:10 [error] 209#209: *104 ngx_child_request_wev_handler: unexpected, output buffer is null, client: 192.168.65.1, server: _, request: "GET /content/s3path/file.mp4/master.m3u8 HTTP/1.1", host: "localhost"

Am I missing something from the conf? A request to this url works:

http://localhost/redirect/s3path/file.mp4

but obviously without the HLS m3u8 manifest, it's just a direct link to the file in the bucket.

erankor commented 5 months ago

Hi, The location to which vod_upstream_location refers to must be a proxy_pass location. In the sample config you pasted, it should point to /proxy instead of /redirect.

comiconomenclaturist commented 5 months ago

Thanks for the this. I'm making some progress now!