gravity-ui-web
gravity-ui-web copied to clipboard
Investigate supporting Brotli compression on Pattern Library & CDN
Is your feature request related to a problem? Please describe. If I'm not mistaken, our static CDN assets and Pattern Library both support gzip compression. However, it would be nice to add support for Brotli which offers better compression.
If this works, we can then implement the same thing on the Buildit website's hosting.
Describe the solution you'd like
- Investigate if/how we can add support for Brotli encoding on our current hosting setup
- If not too cumbersome, add it. And, if it can't be added, document why that is somewhere.
This explains what would have to be done because it is not supported natively by CloudFront: https://medium.com/@felice.geracitano/brotli-compression-delivered-from-aws-7be5b467c2e1 Essentially would have to have more folders with copies of files that are gzipped or Brotli'd at build time and placed in their respective folders, then have Lambda code that figures out if the request supports Brotli or gzip and append to the requested URI to point to the appropriate version of the file.
Sounds like the complexity of the build/deploy and request handling overhead of the two necessary Lambdas would outweigh the benefit. Unless you didn't mind just having only build time Brotli compressed files that are uploaded to S3 and only those are served up in the existing locations. The metadata would have to be tweaked for the files to show the Brotli encoding. Of course this won't work if whoever making the call can't handle Brotli.