[openresty] srcache_store 无效

2019-03-05  本文已影响0人  chenj23986526

openresty 配置 srcache_store 后无效,找了很久都没找到原因,突然在日志中看到如下信息

srcache_store skipped due to response header "Content-Encoding: gzip" 
(maybe you forgot to disable compression on the backend?) 
while reading response header from upstream

查了下官方的说明
默认情况下,如果 response 的头中 Content-Encoding 不为空
则 openresty 不会触发 srcache_store

若要强制缓存则需要设置
srcache_ignore_content_encoding 为 on

还有一种解决思路
请求后端使用 proxy_set_header Accept-Encoding "";
这样后端就不会返回 gzip 后的页面了

官方参考文档

上一篇 下一篇

猜你喜欢

热点阅读