Skip to content

unzstd: Decompresses Zstd-encoded responses for clients that do not support it

Debian/Ubuntu installation

These docs apply to the APT package nginx-module-unzstd provided by the GetPageSpeed Extras repository.

  1. Configure the APT repository as described in APT repository setup.
  2. Install the module:
sudo apt-get update
sudo apt-get install nginx-module-unzstd

Warning

This module is not yet published as nginx-module-unzstd in the APT repositories. Stay tuned, or email [email protected] to request it.


ngx_http_unzstd_filter_module is a filter that decompresses responses with “Content-Encoding: zstd” for clients that do not support “zstd” (Zstandard compression) encoding method. The module will be useful when it is desirable to store data compressed to save space and reduce I/O costs.

Table of Content

Status

This Nginx module is currently considered experimental. Issues and PRs are welcome if you encounter any problems.

Known Issue: 1. Due to improper handling of zstd library dependencies, this module needs to be built together with zstd-nginx-module. I am currently unable to solve this problem. Welcome to submit PR. 2. This module occasionally has a problem of sending the chunked end marker (0\r\n\r\n) twice when decompressing chunked responses. I can't fix it at the moment, so I have to temporarily disable this module. If you are interested in this module, you can try to solve it, and your PR is welcome.

Synopsis

server {
    listen 127.0.0.1:8080;
    server_name localhost;

    location / {
        # enable zstd decompression for clients that do not support zstd compression
        unzstd on;

        proxy_pass http://foo.com;
    }
}

Directives

unzstd

Syntax: unzstd on | off;

Default: unzstd off;

Context: http, server, location

Enables or disables decompression of zstd compressed responses for clients that lack zstd support.

unzstd_force

Syntax: unzstd_force string ...;

Default: -

Context: http, server, location

Defines the conditions for forced brotli decompression. If at least one value in the string parameter is not empty and not equal to "0", forced zstd decompression is performed. But it will not try to decompress responses that do not contain the response header Content-Encoding: zstd.

unzstd_buffers

Syntax: unzstd_buffers number size;

Default: unzstd_buffers 32 4k | 16 8k;

Context: http, server, location

Sets the number and size of buffers used to decompress a response. By default, the buffer size is equal to one memory page. This is either 4K or 8K, depending on a platform.