Skip to main content
On this page

Compressing response bodies

Legacy Documentation

You are viewing legacy documentation for Deno Deploy Classic. We recommend migrating to the new Deno Deploy platform.

Compressing the response body to save bandwidth is a common practice. To take some work off your shoulder, we built the capabilities directly into Deploy.

Deno Deploy Classic supports brotli and gzip compression. Compression is applied when the following conditions are met.

  1. The request to your deployment has Accept-Encoding header set to either br (brotli) or gzip.
  2. The response from your deployment includes the Content-Type header.
  3. The provided content type is compressible; we use this database to determine if the content type is compressible.
  4. The response body size is greater than 20 bytes.

When Deploy compresses the response body, it will set Content-Encoding: gzip or Content-Encoding: br header to the response based on the compression algorithm used.

When is compression skipped? Jump to heading

Deno Deploy Classic skips the compression if:

What happens to my Etag header? Jump to heading

When you set an Etag header with the response, we convert the header value to a Weak Etag if we apply compression to your response body. If it is already a Weak Etag, we don't touch the header.

Did you find what you needed?

Privacy policy