The ZEIT Network layer implements two compression methods; Gzip and Brotli. We highly recommend leveraging ZEIT Network compression over a self hosted solution.
Using the provided compression methods will result in the best performance and least maintenance.
Any client that makes requests to your deployment needs to define the Accept-Encoding header to opt into compression. Many clients (browsers like Chrome, Firefox and Safari) already do this out of the box. If you're making a request from another type of client make sure you use the Accept-Encoding
header to take advantage of compression.
As an example, this is how you ask the Network layer to compress using Brotli:
Accept-Encoding: br
If your client supports Brotli, we generally recommend using it over Gzip, because it usually performs much better.
Nevertheless, some clients might not support it, so to use Gzip:
Accept-Encoding: gzip
Assuming that the program requests deployment resources with the appropriate Accept-Encoding
header, the response will be compressed automatically.