Skip to content

mod_compress

Introduction

mod_compress compresses responses based on specified rules.

Module Configuration

Description

conf/mod_compress/mod_compress.conf

Config Item Description
Basic.DataPath String
Path of rule configuration
Log.OpenDebug Boolean
Whether enable debug logs
Default False

Example

[Basic]
DataPath = mod_compress/compress_rule.data

[Log]
OpenDebug = false

Rule Configuration

Description

Config Item Description
Version String
Vesion of config file
Config Object
Compress rule for each product
Config{k} String
Product name
Config{v} Object
A list of compress rules
Config{v}[] Object
A compress rule
Config{v}[].Cond String
Condition expression, See Condition
Config{v}[].Action Object
Action
Config{v}[].Action.Cmd String
Name of Action
Config{v}[].Action.Quality Integer
Compression level
Config{v}[].Action.FlushSize Integer
Flush size

Module Actions

Action Descrition
GZIP Compress response using gzip method
BROTLI Compress response using brotli method

Example

{
    "Config": {
        "example_product": [
            {
                "Cond": "req_host_in(\"www.example.org\")",
                "Action": {
                    "Cmd": "GZIP",
                    "Quality": 9,
                    "FlushSize": 512
                }
            }
        ]
    },
    "Version": "20190101000000"
}