You don’t have to do this. Netlify automatically serves HTML, CSS, JS among other files with Brotli compression which is better than GZip in compression ratios. However, the support depends on browsers. Most modern browsers support Brotli, but if they don’t Netlify will serve with GZip. If even GZip isn’t supported by the browser, Netlify will fall back to no compression.
Related topics
| Topic | Replies | Views | Activity | |
|---|---|---|---|---|
| Gzip file serving | 31 | 19970 | March 2, 2024 | |
| Gzip / Brotli site.webmanifest files | 4 | 503 | August 16, 2023 | |
| Gzip doesn’t seem to be compressing my files before serving | 2 | 652 | December 28, 2023 | |
| Serving brotli compressed files | 5 | 2792 | January 31, 2022 | |
| Image optimization and compression on React sites | 3 | 2512 | August 13, 2020 |