Page MenuHomePhabricator

Enable gzip transfer encoding for png and ico files in /static
Closed, ResolvedPublic


Our favicon .ico files have gotten larger recently with a bump in resolution and color/alpha depth. While they look great, they've also expanded from a couple kb to for instance 15kb for Wikipedia:

These .ico files gzip very well, however (they're either uncompressed or simple run-length encoding bitmaps, as I recall) and gzip takes that file back down to 2.5kb nicely.

Having the web server auto-gzip the .ico files might be a nice small bandwidth savings, especially on mobile networks.



Event Timeline

bzimport raised the priority of this task from to Medium.Nov 22 2014, 2:59 AM
bzimport set Reference to bz61443.
bzimport added a subscriber: Unknown Object (MLST).

Change 113687 had a related patch set uploaded by Brion VIBBER:
Work in progress: set .svg and .ico files to be compressed on

Krinkle renamed this task from Apply gzip transfer encoding to ICO files from (favicon.ico) to Enable gzip transfer encoding for png and ico files in /static.Jul 2 2015, 3:46 AM
Krinkle updated the task description. (Show Details)
Krinkle set Security to None.
Krinkle removed a subscriber: wikibugs-l-list.

TIL that since gzipping compressed formats like PNGs is pointless, we usually have rules only applying it to icos and SVGs. In the case of the wikipedia favicon there is 1-2kb to save here.

I'm not sure what the current relationship between /static/ and bits is, but I saw this tidbit in bits that I think explains it, at least in terms of wrong assumption:

The favicon is currently served with this MIME type: image/ which means that it doesn't mach the regexp. It's quite certainly the wrong codepath for /static/, though, but it explains why is equally ungzipped.

I can't find any SVGs in /static/, so icos should probably be the focus of the fix.

Change 225852 had a related patch set uploaded (by Gilles):
Fix ICO MIME regexps

Works, although the icons that are already stored in varnish remain ungzipped, because they were cached that way. Adding a cache-busting parameter makes the fix visible: