From bf51ec20e816d2db8c2006629ce45322fa8539f8 Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Wed, 3 May 2017 18:27:45 -0400 Subject: [PATCH] Disable gzip on HEAD requests in `v2` endpoints nginx's gzip module will ignore the content-length header on the HEAD request and try to gzip the body.... but there is no body, so it simply writes no header at all. Code to turn this off was based off of https://trac.nginx.org/nginx/ticket/261 --- conf/nginx/server-base.conf.jnj | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/conf/nginx/server-base.conf.jnj b/conf/nginx/server-base.conf.jnj index c09ec55e5..7e12b0053 100644 --- a/conf/nginx/server-base.conf.jnj +++ b/conf/nginx/server-base.conf.jnj @@ -105,6 +105,10 @@ location ~ ^/v2 { return 404; } + if ($request_method = HEAD ) { + gzip off; + } + # Setting ANY header clears all inherited proxy_set_header directives proxy_set_header X-Forwarded-For $proper_forwarded_for; proxy_set_header X-Forwarded-Proto $proper_scheme;