如何删除双Vary头nginx

时间:2017-01-16 15:00:51

标签: nginx

我想确保我的某些回复不会被任何人缓存。 建议选项之一是设置Vary:*。

不幸的是,如果我添加mv

,我启用了gzip支持的nginx会返回两个Vary标头
add_header "Vary" "*";

知道如何强制只在响应中使用HTTP/1.1 200 OK Server: nginx/1.11.1 Date: Mon, 16 Jan 2017 14:56:16 GMT Content-Type: text/html; charset=utf-8 Transfer-Encoding: chunked Connection: keep-alive X-Content-Type-Options: nosniff X-Frame-Options: SAMEORIGIN Vary: Accept-Encoding Cache-Control: max-age=0, no-cache, no-store, must-revalidate Pragma: no-cache Expires: 0 Vary: * 并对请求进行gzip支持吗?

1 个答案:

答案 0 :(得分:0)

gzip_vary off;

应该停止 gzip 自动添加 Vary 标头。

文档:http://nginx.org/en/docs/http/ngx_http_gzip_module.html#gzip_vary

相关问题