Can proxy_cache gzip cached content?

Massimiliano Mirra hyperstruct at gmail.com
Sat Feb 18 20:43:11 UTC 2012


About this:


>             location /proxied-stuff {
>                     proxy_set_header Accept-Encoding gzip;
>                     proxy_cache_key "$scheme$host$request_uri";
>                     proxy_cache_valid 2d;
>                     proxy_cache myapp_cache;
>                     proxy_pass http://127.0.0.1:85;
>             }
>

I was hoping that gunzip'ping for clients that don't support compression
would be as simple as adding the following inside the above block:

        if ($http_accept_encoding !~* gzip) {
                gunzip on;
        }

But when nginx configuration is reloaded, I get: "nginx: [emerg] "gunzip"
directive is not allowed here".

I suppose I could rewrite the request to an internal location, then within
that location's block re-set the proxy_cache_key accordingly. But perhaps
there's an easier way?

Massimiliano
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20120218/77c3de39/attachment-0001.html>


More information about the nginx mailing list