Schema definition for the Compression Plugin, which provides response compression using gzip, deflate, and brotli algorithms.
Schema Information
Property
Value
Schema URL
https://rustybeam.net/schema/CompressionPlugin
Parent Schema
https://rustybeam.net/schema/UtilityPlugin
Description
Response compression with multiple algorithms and configurable content type filters
Properties
Property
Type
Cardinality
Description
algorithms
https://rustybeam.net/schema/Text
0..1
Comma-separated list of compression algorithms: "gzip", "deflate", "brotli" (or "br"). Defaults to "gzip,deflate,brotli".
min_size
https://rustybeam.net/schema/Number
0..1
Minimum response size in bytes to compress. Responses smaller than this are not compressed. Defaults to 1024 (1KB).
max_size
https://rustybeam.net/schema/Number
0..1
Maximum response size in bytes to compress. Responses larger than this are not compressed. Defaults to 10485760 (10MB).
compressible_types
https://rustybeam.net/schema/Text
0..1
Comma-separated list of MIME types to compress. Defaults to text/html, text/css, text/javascript, text/plain, application/json, application/javascript, application/xml.
compression_level
https://rustybeam.net/schema/Number
0..1
Compression level (1-9): 1=fastest/least compression, 9=slowest/best compression. Defaults to 6 for balanced performance.
name
https://rustybeam.net/schema/Text
0..1
Plugin instance name for identification. Defaults to "compression" if not specified.
Algorithm Selection
The plugin automatically selects the best compression algorithm based on the client's Accept-Encoding header and the configured algorithms list. Brotli is preferred for modern browsers, with gzip as a widely compatible fallback.
Default Compressible Content Types
text/html - HTML documents
text/css - CSS stylesheets
text/javascript - JavaScript files
text/plain - Plain text files
application/json - JSON data
application/javascript - JavaScript applications
application/xml - XML documents
image/svg+xml - SVG images
application/font-woff - WOFF fonts
application/font-woff2 - WOFF2 fonts
Schema Inheritance
This schema inherits from the UtilityPlugin schema, which provides:
logfile - Log file path
directory - Directory configuration
enabled - Plugin enable/disable state
And ultimately from the base Plugin schema, which provides:
library - Plugin library path
plugin - Base plugin reference property
Compression Behavior
Content-Type Check: Only compresses configured MIME types
Size Filtering: Respects min_size and max_size limits
Client Support: Checks Accept-Encoding header
Already Compressed: Skips responses that are already compressed
Header Updates: Sets Content-Encoding and updates Content-Length
Error Handling: Falls back to uncompressed on compression errors
Validation Rules
algorithms must contain valid compression algorithms: "gzip", "deflate", "brotli", "br"
min_size and max_size must be positive integers
max_size should be greater than min_size
compression_level must be between 1 and 9 (inclusive)
compressible_types should contain valid MIME type patterns
The name property should be unique if multiple compression plugins are used
Plugin Pipeline Placement
The Compression Plugin should be placed near the end of the plugin pipeline, after content generation but before access logging. This ensures that generated content is compressed before being sent to clients.