美文网首页
[openresty] srcache_store 无效

[openresty] srcache_store 无效

作者: chenj23986526 | 来源:发表于2019-03-05 13:31 被阅读0次

    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 后的页面了

    官方参考文档

    相关文章

      网友评论

          本文标题:[openresty] srcache_store 无效

          本文链接:https://www.haomeiwen.com/subject/znvnuqtx.html