【发布时间】:2022-02-08 03:57:22
【问题描述】:
我已设置反向代理端口 8086。端口 8086 正在运行一个 javascript,以 webp 格式显示随机图像。如果我尝试访问域,它会将图像显示为乱码。如果我访问 ip 地址而不是域,它工作正常。
我发现more_set_headers "X-Content-Type-Options : nosniff" 导致图像显示为乱码。有没有办法仅删除特定站点的该设置?原因 X-Content-Type-Options : nosniff 设置为适用于所有站点。
nginx 配置
server {
server_name sub.example.com www.sub.example.com;
access_log /var/log/nginx/sub.example.com.access.log ;
error_log /var/log/nginx/sub.example.com.error.log;
add_header X-Proxy-Cache $upstream_cache_status;
location / {
proxy_pass http://xxx.xxx.xxx.xxx:8086/img;
proxy_redirect off;
proxy_set_header X-Content-Type-Options "";
}
}
如何从特定站点删除 X-Content-Type-Options : nosniff?
【问题讨论】:
标签: nginx