假如你的url是http://xxx/abc.file 下载文件名就是abc.file
location /{
if ($args ~ "filename") {
add_header Content-Disposition "filename = $arg_filename";
}
proxy_set_header X-Original-Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host s1-bank.0sm.com:$server_port;
proxy_pass http://url/;
}
现在添加参数http://xxx/abc.file?filename=123.file
下载文件名就变成了123.file