我想确保我的一些回复不会被任何人缓存。建议的选项之一是设置Vary:*。
不幸的是,如果我添加了add_header "Vary" "*";,我的nginx会返回两个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: *你知道如何强制在响应中只有Vary: *和对请求的gzip支持吗?
发布于 2021-02-18 22:00:11
gzip_vary off;应该阻止gzip自动添加Vary。
文档:http://nginx.org/en/docs/http/ngx_http_gzip_module.html#gzip_vary
https://stackoverflow.com/questions/41679263
复制相似问题