Open LeoMcA opened 4 years ago
Ah, it seems CloudFront is already set up to automatically gzip our static assets. However, if we wanted to use brotli then we would have to do this manually.
CloudFront now also supports automatically compressing assets with brotli, we just need to enable it.
While we may get marginally better compression doing it ahead of time, compared to what CloudFront is able to do real-time, since our assets are served from S3 we don't have any ability to vary what gets served based on the Accept-Encoding header.
Continuing from https://github.com/mozilla/kitsune/pull/4437#discussion_r447536143:
Getting
django-pipeline
to gzip assets is pretty quick and easy:https://django-pipeline.readthedocs.io/en/latest/storages.html#gzip-compression
However, from what I can tell all it does is create the .gz archives, we still need to implement conditionally serving them based on the content of the Accept-Encoding header.
We'd also need to ensure CloudFront cached on the Accept-Encoding header.
Since it seems like we'd have to implement a fair chunk of this ourselves, adding brotli support as well shouldn't be much more work.