V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
NGINX
NGINX Trac
3rd Party Modules
Security Advisories
CHANGES
OpenResty
ngx_lua
Tengine
在线学习资源
NGINX 开发从入门到精通
NGINX Modules
ngx_echo
yamada
V2EX  ›  NGINX

对 HEAD 请求禁用 gzip

  •  
  •   yamada · 2016-08-01 15:18:50 +08:00 · 2151 次点击
    这是一个创建于 2831 天前的主题,其中的信息可能已经有所发展或是发生改变。

    这是 NGINX 关于 GZIP 的配置: gzip on; gzip_types application/json application/x-javascript application/javascript text/javascript text/css application/xml text/xml text/plain; gzip_min_length 5k;

    现在发现对 HEAD 的请求也会进行 GZIP 导致 CONTENT-LENGTH 永远显示 0 ,以下是响应: Connection → close Content-Encoding → gzip Content-Length → 0 Content-Type → text/plain; charset=UTF-8

    查了一下, NGINX 1.3 之前确实有 BUG 会对 HEAD 的请求 GZIP ,但是我的 NGINX 是 1.10 的仍然会 GZIP ,不解,尝试过 if ($request_method = HEAD ) { gzip off; } 也没任何作用。

    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   2254 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 25ms · UTC 06:39 · PVG 14:39 · LAX 23:39 · JFK 02:39
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.