Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

We use nginx servers as reverse proxies to our upstream app servers.

Currently all upstream proxy requests are made using an empty Accept-encoding header so that responses from the upstreams are cached decompressed. However, this is inefficient because when nginx serves content to gzip-capable clients it recompresses on the fly using the gzip module.

How can I make nginx cache two copies of a file, one gzipped and one decompressed? I thought that the gzip_static module would do this, but it seems it will only serve exisiting .gz files. So what's the best way to create these when using nginx as a reverse proxy?

share|improve this question
And what if client doesn't support gzip? –  GioMac Oct 30 '12 at 14:54
Then they'll get the uncompressed version which is why it needs to cache compressed & uncompressed per proxied resource. –  andy Oct 30 '12 at 15:13
They you'll need to cache both and will need same space. –  GioMac Oct 31 '12 at 9:44
Have you even read my question? –  andy Oct 31 '12 at 9:52

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.