haproxy-brotli
A Rust-based brotli module for HAProxy 3.2+ Community Edition using the Lua Filter API.
It implemented as a native Lua module written in Rust using mlua and haproxy-api crates.
Usage and Configuration
Please check the module and tests directories for working examples.
HAProxy Configuration
global
master-worker
lua-load-per-thread brotli.lua
...
listen http-in
bind *:8080
filter lua.brotli offload type:text/,application/json
Create a file named brotli.lua with the following content:
local brotli = require
brotli.
Only GET/POST requests with the Accept-Encoding: br header will be compressed.
Configuration Options
The filter lua.brotli directive supports the following options:
offload: Remove theAccept-Encodingheader to prevent backend servers from compressing responses.type:A comma-separated list of MIME type prefixes to compress. Default is empty (all types).quality:NCompression quality level (0-11). Default is 5.window:NThe sliding window size (in bits) to use for compression (10-24). Default is 22.
License
This project is licensed under the MIT license