Override the default gzip rule

If you want to override the default gzip rule, follow the steps below:

Click the Create gzip button. The Create a gzip page appears.

Click the Override these defaults link on the page. The additional gzip fields appear.

Fill out the Create a gzip fields as follows:

In the Name field, type an arbitrary name for your new gzip rule.

In the Extensions field, type the file extension for each file type to be dynamically gzipped, separated by spaces. Only type the three- or four-letter string representing the file extension. We recommend setting the Extensions to css js html eot ico otf ttf json.

In the Content Types field, type the content-type for each type of content you wish to have dynamically gzipped, separated by spaces. Do not use regular expressions. We recommended setting the Content Types to the following:

Automatic normalization

Because GZip is one of the most common reasons to vary output based on a request header, Fastly will normalize the value of Accept-Encoding on incoming requests. The modified header will be set to a single encoding type, or none, and will reflect the best compression scheme supported by the browser. This includes removing Accept-Encoding values in requests from browsers that advertise support for GZip but whose implementation is broken, such as IE6.

Specifically, we run the following steps on inbound requests:

If the User-Agent matches a pattern for browsers that have problems with compressed responses, remove the Accept-Encoding header

Else if the Accept-Encoding header includes the string "gzip", set the entire value to the string "gzip"

Else if the Accept-Encoding header includes the string "deflate", set the entire value to the string "deflate"

Else remove the Accept-Encoding header

Where this normalization process has changed the header value, the original value is made available in the custom header Fastly-Orig-Accept-Encoding.

If a user agent advertises support for brotli, currently we will normalize this to gzip because we do not support brotli encoding at the edge. However, if you are doing brotli encoding at your origin server, you may want to modify our normalization algorithm.

Was this guide helpful?

Yes
No

Tell us what worked and what we could do better.

Do not use this form to send sensitive information. If you need assistance, contact support@fastly.com.