nginx 代理传递内容范围

nginx proxy pass content range

如果Range header 由用户传递,如何让nginx 发送源服务器?

目前我正在尝试这个,但没有成功:

server {
    location / {
        if ($http_range) {
            set $var_arg_range $http_range;
        }
        if ($arg_range) {
            set $var_arg_range "bytes=$arg_range";
        }
        proxy_set_header Range $var_arg_range;
        proxy_pass https://content-na.drive.amazonaws.com;
        proxy_set_header If-Range "";
        proxy_set_header Host content-na.drive.amazonaws.com;
        proxy_set_header Range $var_arg_range;
        proxy_set_header Accept-Encoding "";
    }
}

我需要让 html5 视频可以流式传输。

终于找到了。我需要使用 proxy_pass_request_headers 将 headers 传递到源服务器。并且不要忘记传递您的自定义 Referer header:

server {
            postpone_output 0;
            resolver 8.8.8.8;
            proxy_set_header Referer        "https://content-na.drive.amazonaws.com";
            proxy_set_header Host           "content-na.drive.amazonaws.com";
            proxy_pass_request_headers      on;
            proxy_ssl_verify                off;
            proxy_method                    "GET";
            proxy_pass                      https://content-na.drive.amazonaws.com;
}