gzip_static module does not obey mime types

Matt Gadient jdi_knght at hotmail.com
Fri Aug 24 10:55:02 UTC 2018


I've noticed for a while that when gzip_static is enabled it checks *every* file it serves for a .gz extension, not just the ones listed in the gzip_types. For example in a page with 1 html and 30 images you'll have 61 requests to the file system: 1 for the correct .html.gz file, 30 for the non-existent .png.gz files, and 30 for the .png files.

You can verify this on a running server that has gzip_static on, with "strace -p PID 2>&1 | grep gz" (where PID is an nginx worker's PID). Visit a page of the site that has images and you'll get a whole bunch of "-1 ENOENT (No such file or directory)" in the output attached to /var/www/website/image.png.gz files.

I am wondering if this is intentional or if it is a bug. Thanks for your time.




More information about the nginx mailing list