Question

I'm trying to figure out why some of my javascript files are served with gzip compression and others are not.

Compressed: http://curecarpaltunnel.info/js/ext/require.js

Uncompressed: http://curecarpaltunnel.info/js/common.js

In my Nginx config (/etc/nginx/nginx.conf), in the "http" section, I have:

gzip on;
gzip_comp_level 5;
gzip_http_version 1.0;
gzip_proxied any;
gzip_min_length 1100;
gzip_buffers 16 8k;
gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;

# Disable for IE < 6 because there are some known problems
gzip_disable "MSIE [1-6].(?!.*SV1)";

# Add a vary header for downstream proxies to avoid sending cached gzipped files to IE6
gzip_vary on;

Why would some javascript files be compressed and others not? Is it something to do with RequireJs?

https://stackoverflow.com/a/9140223/470749 is how I could tell which files were being compressed.

Was it helpful?

Solution

Well, you did set the minimum length for compression to 1,100 bytes (gzip_min_length). Files smaller than that will not be compressed.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top