All JavaScript files are not compressed by nginx gzip.
CSS files are working.
In my nginx.conf
I have the following lines:
gzip on;
gzip_disable "MSIE [1-6]\.(?!.*SV1)";
gzip_proxied any;
gzip_buffers 16 8k;
gzip_types text/plain application/x-javascript text/xml text/css;
gzip_vary on;
This is interesting, because the best-supported, old standard mime type for javascript in the browser is actually text/javascript. And if you configure that, in
/etc/nginx/mime.types
, it works.From this thread: text/javascript vs application/javascript
So the gzip module of nginx is simply built against previous standards, and apparently doesn't properly process the application/javascript mime type.
Change this line:
To be this:
Note the addition of
application/javascript
andtext/javascript
to your list of gzip types.There are also more details—and a more expansive list of gzip types—in the answer posted here.