Skip to content

Potentially compress (gzip / brotlifi) certain files automatically

Summary

GitLab Pages allows to precompress files and put them next to the gzipped/brotlified files uncompressed files. If a HTTP client supports gzip / br, we serve those compressed files.

While it's a great feature, it's easy to forget to pre-compress the files. If now a file is requested "a lot", more data is send over the wire than needed. This can incur a lot of egress, especially on e.g. GitLab.com.

There are potentially multiple approaches here:

  1. Start gzipping / brotlying automatically in case the pre-compressed assets do not exist
  2. Only do it for a subset of projects (feature flag?)

Steps to reproduce

  1. Serve a file
  2. Forget to compress it in CI

Example Project

In the very widely https://charts.gitlab.io/index.yaml is about 1.22 MiB. Compressed it is 77 KiB. We can save 93% egress if the file were simply gzupped

What is the current bug behavior?

N/A

What is the expected correct behavior?

N/A

Relevant logs and/or screenshots

Output of checks

Possible fixes