Open Nuklon opened 2 years ago
Should be handled upstream first like it was done for gzip https://github.com/matomo-org/matomo/pull/13633. Suggest to open an issue there.
I meant to enable it in nginx, similar to gzip is done right now (https://github.com/crazy-max/docker-matomo/blob/23e0574c78fce4cd1b697103e8187b0930234a19/rootfs/tpls/etc/nginx/nginx.conf#L55).
I meant to enable it in nginx
We would need to compile the module as it's not available in its current state. Also I don't think it brings any real benefit against gzip (at most 17% from what I see from different benchmark).
We would need to compile the module as it's not available in its current state.
Oh my bad it's in the alpine: https://git.alpinelinux.org/aports/tree/main/nginx/APKBUILD?h=3.15-stable#n150
Let me know if you want to open a PR and make some tests with this sample configuration.
I think the images need to be built with brotli module, https://github.com/nginxinc/docker-nginx/tree/master/modules (I don't know how to do that though). With just the config it doesn't work as the brotli module doesn't seem present on the image (at least the brotli module import fails as it (and also I) cannot find the brotli module on the image). I will experiment a little with this and see if I can get something working.
Regarding the savings, the matomo js file is ~30% smaller when compressed with Brotli.
I don't know how to enable in your dockerfile, but I have tried the original matomo docker image and it works there without problems (at least I couldn't find any). Right now gzip is 23.96KB, with Brotli that goes down to 19.73KB. But it doesn't only save on size, decompression speed is also ~1.5x better. That's quite noticable on slower phones.
Right now only gzip compression is enabled, perhaps brotli can also be enabled? This significantly reduces matomo.js file size.