What is the canonical method for an HTTP client to instruct an HTTP server to disable gzip responses?

Homer6 picture Homer6 · Dec 6, 2012 · Viewed 10k times · Source

I thought this was a simple google search, but apparently I'm wrong on that.

I've seen that you should supply:

Accept-Encoding: gzip;q=0,deflate;q=0

in the request headers. However, the article that suggested it also noted that proxies routinely ignore that header. Also, when I supplied it to nginx, it still compressed the response message body.

http://forgetmenotes.blogspot.ca/2009/05/how-to-disable-gzip-compression-in.html

So, how do I tell a web server to disable compression on the response message body?

Answer

Jack Wester picture Jack Wester · Dec 7, 2012

Many web servers ignore the 'q' parameter. The compressed version of a static resource is often cached and is returned whenever the request accepts it. To avoid getting compressed resources, use

Accept-Encoding: identity

The server should not serve you a compressed representation of the resource in this instance. Nor should any proxy. This is the default accepted encoding if none is given, but your client might add a default that accepts gzip, so explicitly providing 'identity' should do the trick.