NGINX
NGINX Trac
3rd Party Modules
Security Advisories
CHANGES
OpenResty
ngx_lua
Tengine
在线学习资源
NGINX 开发从入门到精通
NGINX Modules
ngx_echo
yamada
V2EX  ›  NGINX

对 HEAD 请求禁用 gzip

  •  
  •   yamada · Aug 1, 2016 · 2554 views
    This topic created in 3571 days ago, the information mentioned may be changed or developed.

    这是 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; } 也没任何作用。

    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3187 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 44ms · UTC 14:27 · PVG 22:27 · LAX 07:27 · JFK 10:27
    ♥ Do have faith in what you're doing.