SOLUTION: It turns out it is not my config / NGINX faults – my DNS provider, cloudflare, is preventing the fonts from being GZipped for some reason
I'm using NGINX with GZIP_Static module installed.
I'm trying to get my .SVG/.TTF @FONT-FACE font files to be served via GZip, as there will be a reduction in about 50% file size. I've added the following mimetypes to the mime.types file:
image/svg+xml svg;
application/x-font-ttf ttf;
font/opentype otf;
application/vnd.ms-fontobject eot;
font/x-woff woff;
The fonts are all placed in a single folder, so I first tried setting up folder-specific gzip settings as follows:
location /sites/default/files/fontyourface/local_fonts/ {
gzip_types image/svg+xml application/x-font-ttf font/opentype ;
}
That didn't work, so I tried just adding the Mime types to the "universal" gzip_types definition in nginx.conf – that didn't work either.
I've gone in and manually gzipped the font files so GZIP_Static can be used. That didn't work either.
Any ideas as to what I am doing wrong / how I can set NGINX up to return the GZIP'd versions of only .SVG and .TTF files?
Best Answer
CloudFlare will only gzip TTFs if they are transferred with one of these mime types:
Source: https://support.cloudflare.com/hc/en-us/articles/200168396-What-will-CloudFlare-gzip-