X-Content-Type-Options使图像显示为胡言乱语的文本[nginx]



我设置了反向代理端口8086。端口8086正在运行一个javascript,该javascript以webp格式随机显示图像。如果我试图访问该域,它会将图像显示为胡言乱语的文本。如果我访问ip地址,但不访问域,它会正常工作。

我已经知道more_set_headers "X-Content-Type-Options : nosniff"导致图像显示为胡言乱语的文本。有没有办法只删除特定站点的设置?causeX-Content-Type-Options:nosniff设置为应用于所有站点。

nginx-conf

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?

这可以在;"功能性";方法:始终使用映射{}中的值添加标头。映射$host$nosniff{myhost";默认nosniff;}

最新更新