View Issue Details

IDProjectCategoryView StatusLast Update
0002670Composrcorepublic2019-12-11 21:38
ReporterChris GrahamAssigned ToChris Graham 
Status resolvedResolutionfixed 
Product Version 
Fixed in Version 
Summary0002670: Support Brotli compression
DescriptionBrotli compression, which is very new, may present roughly 20% improvement over gzip.

It isn't yet supported by PHP or Apache (, but when it is, we should support it as an automated upgrade from gzip compression for those users that can run it (Firefox, Chrome - but we look at the Accept-Encoding header). I don't think it needs to be configurable.
TagsRoadmap: v12, Type: Performance
Attach Tags
Time estimation (hours)4
Sponsorship open


Chris Graham

2019-09-30 22:35

administrator   ~0006098

Brotli is similar to gzip, but uses an inbuilt dictionary optimized for web traffic.

"Javascript files compressed with Brotli are 14% smaller than gzip. HTML files are 21% smaller than gzip. CSS files are 17% smaller than gzip."

There is a PHP extension we can support:

We can also try our .htaccess trick of serving pre-heavily-compressed .br files directly if the browser accepts them, like we currently do with .gz.

Chris Graham

2019-11-27 19:55

administrator   ~0006188

Last edited: 2019-11-27 19:57

View 2 revisions

Interesting/relevant note - Brotli is HTTPS-only. This is because they figure proxies will cache Brotli content served under HTTP and cause all kinds of bugs for UAs not supporting it.

Chris Graham

2019-12-10 23:57

administrator   ~0006217

Last edited: 2019-12-11 02:27

View 2 revisions

Also see
EDIT: While zstd (aka zstandard) is gaining adoption, and is by a web company, it is not itself designed as an HTTP compression scheme, and nobody is picking it up as such.

Chris Graham

2019-12-11 18:31

administrator   ~0006219

Last edited: 2019-12-11 21:38

View 2 revisions

This is now implemented. It does not depend on Apache or PHP supporting Brotli, as I've taken a different approach. The old gzip option is now an output compression option, and you can select to output Brotli (which falls back to gzip if needed). If there's no PHP support for Brotli it will encode via shell_exec to the brotli executable (EDIT: but not for the main HTML output, as you cannot set an output_filter to a user-defined function or set one at run-time, and output buffers are not appropriate for implementing compression as they may process multiple times).

Issue History

Date Modified Username Field Change
2016-06-19 17:05 Chris Graham New Issue
2016-06-19 17:05 Chris Graham Tag Attached: Type: Performance
2017-04-08 14:44 Chris Graham Description Updated View Revisions
2019-06-27 19:23 Chris Graham Summary Support Brotli compression (holding issue) => Support Brotli compression (on hold)
2019-09-30 22:35 Chris Graham Note Added: 0006098
2019-09-30 22:35 Chris Graham Summary Support Brotli compression (on hold) => Support Brotli compression
2019-11-14 22:04 Chris Graham Tag Attached: Roadmap: v12
2019-11-27 19:55 Chris Graham Note Added: 0006188
2019-11-27 19:57 Chris Graham Note Edited: 0006188 View Revisions
2019-12-10 23:57 Chris Graham Note Added: 0006217
2019-12-11 02:27 Chris Graham Note Edited: 0006217 View Revisions
2019-12-11 18:31 Chris Graham Assigned To => Chris Graham
2019-12-11 18:31 Chris Graham Status non-assigned => resolved
2019-12-11 18:31 Chris Graham Resolution open => fixed
2019-12-11 18:31 Chris Graham Note Added: 0006219
2019-12-11 21:38 Chris Graham Note Edited: 0006219 View Revisions