A simple OpenResty implementation of HTTP compression dictionary transport and related tools.
brotli_dictionary_generator: A dictionary generator provided by Brotli, used to train the dictionary.
zstd_dictionary_converter: Converts the Zstandard-formatted dictionary to a raw dictionary.
Depends on Zstandard; include zstd shared library and zstd-ffi.
Dynamic compression requires training the dictionary first, and all subsequent content will be compressed using the same dictionary.
To train the dictionary:
# use zstd to train dictionary
zstd --train content/* -o zstd_dict.dat
zstd_dictionary_converter -i zstd_dict.dat -o dict.dat
# use brotli_dictionary_generator
brotli_dictionary_generator dict.dat content/*Change the dict_location in the OpenResty configuration.
Static compression will use the response as a dictionary. It is suitable for resources that change little between different versions.
There is no need to train the dictionary first.