Improve performance with Brotli compression
Kong Gateway supports the ngx_brotli module through its Nginx directives injection mechanism. Brotli is a compression algorithm for high-performance websites. It’s designed to be better at compression than other commonly used algorithms such as gzip and deflate. You can use it to speed up your applications, improve page speed, reduce data transmitted, and improve the overall performance of Kong Gateway.
Enable Brotli compression
Set the following parameters in kong.conf
to enable Brotli compression:
nginx_proxy_brotli = "on"
nginx_proxy_brotli_comp_level = 5
nginx_proxy_brotli_types = "text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript text/x-js"
We recommend setting a compression level (nginx_proxy_brotli_comp_level
) of 4 or 5 as a balanced option, as it still provides a smaller payload than the highest gzip compression level without compromising processing time [1].