haproxy-brotli 0.1.0

HAProxy filter for brotli compression support
Documentation
  • Coverage
  • 66.67%
    2 out of 3 items documented0 out of 2 items with examples
  • Size
  • Source code size: 30.79 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.01 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 1m 17s Average build duration of successful builds.
  • all releases: 1m 17s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • khvzak/haproxy-brotli
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • khvzak

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