Nginx not compressing tff files

nadermx asked:

I have added this to my nginx config

gzip_types application/javascript application/font-ttf text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/vnd.ms-fontobject application/x-font-ttf font/opentype image/svg+xml image/x-icon;

But when I run a webpagetest.org I get this result

Use gzip compression for transferring compressable responses: 67/100

707.7 KB total in compressible text, target size = 471.6 KB - potential savings = 236.1 KB

WARNING - (167.7 KB, compressed = 88.1 KB - savings of 79.5 KB) - https://example.com/static/fonts/Roboto-Regular.ttf
WARNING - (166.4 KB, compressed = 88.0 KB - savings of 78.5 KB) - https://example.com/static/fonts/Roboto-Light.ttf
WARNING - (166.8 KB, compressed = 88.7 KB - savings of 78.1 KB) - https://example.com/static/fonts/Roboto-Bold.ttf

Should I add in a different type of gzip_types to the config?

My answer:


The default nginx configuration shipped with nginx doesn’t include a MIME type for TrueType font files. You can see the MIME types that are configured in the shipped file /etc/nginx/mime.types.

You can add to the existing types block in your nginx configuration.

types {

    .....

    application/x-font-ttf ttf;
}

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.