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'?
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.
You should add
$http_accept_encoding
to your cache key, or use gunzip module.