server {
listen 82;
server_name _;
location /oss/ {
client_max_body_size 200m;
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Headers' '*';
add_header 'Access-Control-Allow-Methods' '*';
return 200;
}
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Headers' '*';
add_header 'Access-Control-Allow-Methods' '*';
add_header X-Content-Type-Options "nosniff";
proxy_hide_header 'Content-Disposition';
add_header Content-Disposition "inline" always;
proxy_set_header Host oss-cn-nanjing-jscn-d01-a.ops.alicloudpublic.jsdata.cegn.cn;
proxy_pass http://oss-cn-nanjing-jscn-d01-a.ops.alicloudpublic.jsdata.cegn.cn/;
}
}
在HTTP响应头中添加Content-Disposition字段,字段值为inline或attachment。其中,inline表示在浏览器中直接显示数据,attachment表示以附件形式下载数据。
篡改Content-Disposition:
add_header Content-Disposition “inline” always;
报错:ERR_RESPONSE_HEADERS_MULTIPLE_CONTENT_DISPOSITION
解决方法:
proxy_hide_header ‘Content-Disposition’;
Categories:
大数据运维