zstd_types

The `zstd_types` directive specifies which MIME types should be compressed using the Zstandard (zstd) compression algorithm.

Syntaxzstd_types mime_type[, mime_type...];
Defaultnone
Contexthttp, server, location
Arguments1+

Description

The zstd_types directive is part of the NGINX module for Zstandard compression and allows the user to define a list of MIME types that the Zstandard compressor should target for compression. It can be used in the http, server, and location contexts, allowing for specific configurations at different levels of the server's architecture. By specifying the types of files that will be served, NGINX can optimize network bandwidth by compressing only eligible files, leading to improved load times and reduced data usage.

To use the directive, one or more MIME types can be specified. For instance, if zstd_types application/json text/html; is defined, NGINX will compress responses of JSON and HTML files using the zstd compression algorithm. This directive is particularly useful for modern web applications that regularly transmit large payloads, as it can significantly enhance performance when sending data to clients that support the zstd method.

It's also important to note that this directive does not have inherent checks to see if the client supports zstd compression; it is recommended to handle this at the application or server level using appropriate headers to negotiate compression support on connection setup. Therefore, careful consideration of client capabilities is essential to ensure compatibility.

Config Example

http {
    zstd on;
    zstd_types application/json text/html;
}

Ensure that the specified MIME types are supported by the clients receiving the responses; otherwise, they may not be able to decompress the content correctly.

Avoid specifying overly broad MIME types as it could lead to performance issues if large uncompressible files are included.

Check compatibility and support for Zstandard compression in client applications.

← Back to all directives