cache gzipped content with proxy_pass

chrisl nginx-forum at nginx.us
Mon Aug 16 16:56:47 MSD 2010


Hi.

AFAIK nginx only stores plain (uncompressed) content when acting as a
caching proxy server. With gzip=on, content for gzip-accepting clients
will be compressed by the server _for_ _every_ _request_ (?).

Wouldn't it be better to have two cache files like this:

/data/nginx/cache/c29b7f54b2df7773722d382f4809d65029c
/data/nginx/cache/c29b7f54b2df7773722d382f4809d65029c.gz

Another solution would be to add the internal variable gzip_ok to the
config variable space. Then one could add this variable to
proxy_cache_key:

 proxy_cache_key "...:$gzip_ok:..."

Currently I've added http_accept_enconding to the cache key, but since
there are hundreds of different permutations for the value this is not
an optimal solution.

Chris

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




More information about the nginx mailing list