Setting Gzip comression on Nginx


#1

Hi guys, I am having trouble setting Gzip on on nginx, I have the below code on my .conf file (/home/user/nginx/example.com/abc.conf)

gzip on;
gzip_min_length 1000;
gzip_http_version 1.1;
gzip_proxied expired no-cache no-store private no_last_modified no_etag auth any;
gzip_comp_level 9; 
gzip_types text/css text/plain text/xml application/xml application/xml+rss text/javascript application/x-javascript;
gzip_vary on;
gzip_disable "msie6";

this code is not causing any errors, so I assume it is working properly.But the problem is that it is not enabling caching on the browsers. Interestingly on the documentation page (http://wiki.nginx.org/HttpGzipModule) they say Content-Length header is not set when using gzip_http_version, and for gzip_min_length they say “Length is determined from the “Content-Length” header” and when i checked headers content-length wasn’t there. but some minimum length seems to be required for compression

So my question is How do I set content-length header or how do I get nginx to compress files even without it

please Help me out guys, thanks


#2

Problem seems to be solved now, I was using expires header as well as gzip header; so expires was serving old cache, than the new gzipped cache; cleared all the cache on my browser and it is now zipping as well as uses cache