Brotli compression delivered from AWS

What is Brotli?

Brotli content sent to your Chrome browser


  • 14% smaller than gzip for JavaScript
  • 21% smaller than gzip for HTML
  • 17% smaller than gzip for CSS
Logo of the Brotli compression format.

Which Browsers support it?

Setup for AWS (CloudFront + S3 + Lambda = ⚡️)

AWS Console: CloudFront Configuration Panel With auto compression.
AWS Lambda Edge event cycle
  1. Compress files at build time and provide Gzip and Brotli version.
  2. Upload your build files in 2 separate paths of the S3 Bucket.
S3 Bucket: gzip and brotli folders.
S3 Bucket: change content-encoding for each type-
  • Go to AWS Lambda in AWS console
  • Create a function with new name viewer-request-handler
  • Paste the following NodeJs code.
AWS Lambda Edge Node.js handler for Viewer Request
AWS Lambda Edge Node.js handler for Origin Request
AWS CloudFront: Setup Event Lambda Function.




Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store