Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm developing a rails web services with ngnix + passenger, and I use reverse proxy cache in nginx. It works quite well and very fast. The problem is that some clients don't support gzip while some others support.

What I found out is that nginx caches the gzip content, therefore if the gzip-supported clients request first, then the non-gzip clients request, the server still returns gzip content even if the client sends the header "Accept-Encoding": "".

gzip  on;
gzip_http_version 1.0;
gzip_vary on;
gzip_comp_level 6;
gzip_proxied any;
gzip_types text/plain text/css text/javascript application/javascript application/json application/x-javascript text/xml application/xml application/xml+rss;

Do you have to cache them separately by combining the request_uri and header 'Accept-Encoding'?

share|improve this question

That could be a fixed bug. At least I do not observe the behavior in 0.8.54. Try to upgrade your nginx if it's not the latest.

share|improve this answer
I'm using nginx 0.7.67. – Chamnap Mar 31 '11 at 1:24
I'm upgrade to 0.8.54, but the problem still exists. – Chamnap Mar 31 '11 at 3:38

You should add $http_accept_encoding to your cache key, or use gunzip module.

share|improve this answer

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.