1

如果用户传递Range标头,我如何让 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 视频可流式传输。

4

1 回答 1

4

最后我找到了。我需要使用proxy_pass_request_headers将标头传递给源服务器。并且不要忘记传递您的自定义 Referer 标头:

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;
}
于 2016-10-28T04:56:27.297 回答