# Gzip compression won't disable

**URL:** <https://www.ruby-forum.com/t/gzip-compression-wont-disable/246094>\
**Category:** NGINX\
**Created:** [August 22, 2013, 3:48am UTC](https://www.ruby-forum.com/t/gzip-compression-wont-disable/246094 "2013-08-22T03:48:32Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rafa\_F](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/958977/32.png) [@Rafa\_F](https://www.ruby-forum.com/u/Rafa_F)\
**Post date:** [August 22, 2013, 3:48am UTC](https://www.ruby-forum.com/t/gzip-compression-wont-disable/246094/1 "2013-08-22T03:48:32Z")

</div>

Hey all,

I’m running nginx 1.2.6 from a packaged install on Ubuntu 13.04. I’m at  
a  
total loss as to how this is happening but I simply cannot disable gzip  
compression for my server no matter what I try. Setting gzip off; in  
nginx.conf in the http context doesn’t work. I modified the default  
config  
setting that was already there. I even moved it to the bottom of the  
section to see if maybe there was something else that was toggling it on  
after that config entry.

Is there something else I can look for that would be enabling gzip  
compression on my server? I saw there’s a static gzip compression module  
that’s optionally compiled in but that doesn’t seem relevant to my  
situation as this is a REST call.

Here’s my response header from curl which does not appear to gzip  
compress:

HTTP/1.1 200 OK  
Server: nginx/1.2.6 (Ubuntu)  
Date: Thu, 22 Aug 2013 00:08:26 GMT  
Content-Type: application/json  
Content-Length: 0  
Connection: keep-alive  
P3P: CP=“CAO PSA OUR”  
Set-Cookie:  
jcid=5215567ae4b0861a8dd5c1dc;Path=/;[Domain=.foo.com](http://Domain=.foo.com);Expires=Fri,  
22-Aug-2014 00:08:26 GMT;Max-Age=31536000  
Expires: Thu, 01 Jan 1970 00:00:00 GMT  
ETag: “5215567ae4b0861a8dd5c1dc”

However that same URL’s response headers in any browser (chrome, FF,  
safari) are as follows:

Connection:keep-alive  
Content-Encoding:gzip  
Content-Type:application/json  
Date:Thu, 22 Aug 2013 01:39:24 GMT  
ETag:“521462bfe4b00dcc1c3b7c52-gzip”  
Expires:Thu, 01 Jan 1970 00:00:00 GMT  
P3P:CP=“CAO PSA OUR”  
Server:nginx/1.2.6 (Ubuntu)  
Set-Cookie:jcid=521462bfe4b00dcc1c3b7c52;Path=/;[Domain=.foo.com](http://Domain=.foo.com);Expires=Fri,  
22-Aug-2014 01:39:24 GMT;Max-Age=31536000  
Transfer-Encoding:chunked  
Vary:Accept-Encoding, User-Agent

I’m certain that I’m doing something wrong but I’m out of ideas at the  
moment on what to check. Thanks for any insight or pointers anyone may  
be  
able to provide.

Cheers!

---

<div class="post-metadata">

**Author:** ![mrkohrea](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/4491bb/32.png) [@mrkohrea](https://www.ruby-forum.com/u/mrkohrea)\
**Post date:** [August 22, 2013, 3:59am UTC](https://www.ruby-forum.com/t/gzip-compression-wont-disable/246094/2 "2013-08-22T03:59:38Z")

</div>

My guess: If the compressed files are pregenerated and sitting on the  
filesystem (e.g. you have blah.json and blah.json.gz), nginx will serve  
them  
to any browser that sends the correct Accept-Encoding headers.

Good luck.

Posted at Nginx Forum:

> **[Re: gzip compression won't disable](https://forum.nginx.org/read.php?2,242107,242108#msg-242108)**
>
> Hey all, I'm running nginx 1.2.6 from a packaged install on Ubuntu 13.04. I'm at a total loss as to how this is happening but I simply cannot disable gzip compression for my server no matter what I try. Setting gzip off; in nginx.conf in the http...

---

<div class="post-metadata">

**Author:** ![mrkohrea](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/m/4491bb/32.png) [@mrkohrea](https://www.ruby-forum.com/u/mrkohrea)\
**Post date:** [August 22, 2013, 4:39am UTC](https://www.ruby-forum.com/t/gzip-compression-wont-disable/246094/3 "2013-08-22T04:39:22Z")

</div>

Hello,

On Wed, Aug 21, 2013 at 9:48 PM, Michael K. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Hey all,
> 
> I’m running nginx 1.2.6 from a packaged install on Ubuntu 13.04. I’m at a  
> total loss as to how this is happening but I simply cannot disable gzip  
> compression for my server no matter what I try. Setting gzip off; in  
> nginx.conf in the http context doesn’t work. I modified the default config  
> setting that was already there. I even moved it to the bottom of the  
> section to see if maybe there was something else that was toggling it on  
> after that config entry.

​​I’m not​ sure moving the directive around the same level has any  
impact  
if you don’t have another ‘gzip’ directive there.  
Have you checked that there is no gzip at inferior levels (server or  
location blocks).  
Even better: gzip directive is internally set to ‘off’. Check that there  
is  
no ‘gzip’ usage anywhere in any included file of your configuration  
(simple  
grep) and you’ll have the conf you wish.

## 2nd part: Check your conf is _really_ applied on reload: first, check the syntax with nginx -t, then monitor the logs when reloading to see any error popping up.

_B. R._
