Welcome! Log In Create A New Profile

Advanced

Re: cache gzipped content with proxy_pass

Maxim Dounin
August 16, 2010 10:52AM
Hello!

On Mon, Aug 16, 2010 at 08:56:47AM -0400, chrisl wrote:

> AFAIK nginx only stores plain (uncompressed) content when acting as a
> caching proxy server.

Not really. nginx caches what upstream server sent to it. If
response was compressed by upstream server - it will cache
compressed response.

> With gzip=on, content for gzip-accepting clients
> will be compressed by the server _for_ _every_ _request_ (?).

Yes - unless upstream server already returned precompressed
content.

> Wouldn't it be better to have two cache files like this:
>
> /data/nginx/cache/c29b7f54b2df7773722d382f4809d65029c
> /data/nginx/cache/c29b7f54b2df7773722d382f4809d65029c.gz

You may want to follow this thread:

http://nginx.org/pipermail/nginx/2010-March/019471.html

It is believed that separate gzip cache is better idea.

> 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.

The problem is that nginx itself and upstream server may have
different ideas on what may be compressed. And you need
upstream's one here, not nginx's one. Though probably it's
a good idea to expose nginx's one anyway.

Maxim Dounin

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

cache gzipped content with proxy_pass

chrisl August 16, 2010 08:56AM

Re: cache gzipped content with proxy_pass

Maxim Dounin August 16, 2010 10:52AM

Re: cache gzipped content with proxy_pass

chrisl August 21, 2010 07:27AM

Re: cache gzipped content with proxy_pass

adamchal May 26, 2011 08:28PM

Re: cache gzipped content with proxy_pass

SplitIce May 26, 2011 11:50PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 68
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready