Can proxy_cache gzip cached content?

rmalayter nginx-forum at nginx.us
Wed Feb 15 14:55:17 UTC 2012


bard Wrote:
-------------------------------------------------------
> Thanks for the pointers. As I wrote, I'd rather
> avoid gzipping in the
> backend, but if that's the only option so be it.
> 

There's no reason the "backend" for your caching layer cannot be another
nginx server block running on a high port bound to localhost. This
high-port server block could do gzip compression, and proxy-pass to the
back end with "Accept-Encoding: identity", so the back-end never has to
do compression. The backend server will have to use "gzip_http_version
1.0" and "gzip_proxied any" to do compression because it is being
proxied from the front-end.

There might be a moderate performance impact, but because you're caching
at the "frontmost" layer, the number of back-end hits should be small.

Also note there may be better options in the latest nginx versions, or
by using the gunzip 3rd-party module:
http://mdounin.ru/hg/ngx_http_gunzip_filter_module/file/27f057249155/README

With the gunzip module, you can configure things so that you always
cache compressed data, then only decompress it for the small number of
clients that don't support gzip compression.

--
RPM

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,222382,222436#msg-222436



More information about the nginx mailing list