如果用户传递范围标题,如何让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视频。
答案 0 :(得分:3)
最后我发现了它。我需要使用 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;
}