haproxy-brotli

Crates.iohaproxy-brotli
lib.rshaproxy-brotli
version0.1.0
created_at2025-09-19 15:11:31.962155+00
updated_at2025-09-19 15:11:31.962155+00
descriptionHAProxy filter for brotli compression support
homepage
repositoryhttps://github.com/khvzak/haproxy-brotli
max_upload_size
id1846598
size31,494
Alex Orlenko (khvzak)

documentation

README

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("haproxy_brotli_module")
brotli.register()

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 the Accept-Encoding header to prevent backend servers from compressing responses.
  • type: A comma-separated list of MIME type prefixes to compress. Default is empty (all types).
  • quality:N Compression quality level (0-11). Default is 5.
  • window:N The sliding window size (in bits) to use for compression (10-24). Default is 22.

License

This project is licensed under the MIT license

Commit count: 1

cargo fmt