compression-normalize: NGINX Accept-Encoding Normalization module
Debian/Ubuntu installation
These docs apply to the APT package nginx-module-compression-normalize provided by the GetPageSpeed Extras repository.
- Configure the APT repository as described in APT repository setup.
- Install the module:
sudo apt-get update
sudo apt-get install nginx-module-compression-normalize
Show suites and architectures
| Distro | Suite | Component | Architectures |
|----------|-------------------|-------------|-----------------|
| debian | bookworm | main | amd64, arm64 |
| debian | bookworm-mainline | main | amd64, arm64 |
| debian | trixie | main | amd64, arm64 |
| debian | trixie-mainline | main | amd64, arm64 |
| ubuntu | focal | main | amd64, arm64 |
| ubuntu | focal-mainline | main | amd64, arm64 |
| ubuntu | jammy | main | amd64, arm64 |
| ubuntu | jammy-mainline | main | amd64, arm64 |
| ubuntu | noble | main | amd64, arm64 |
| ubuntu | noble-mainline | main | amd64, arm64 |
Describe
ngx_http_compression_normalize_module is an Nginx module designed to parse, normalize, and manage the Accept-Encoding headers from client requests. It ensures consistent handling of compression algorithms by standardizing the Accept-Encoding values, facilitating better compression management and improved vary cache performance.
Table of Content
- ngx_http_compression_normalize_module
- Describe
- Table of Content
- Status
- Synopsis
- Installation
- Directives
- Variables
- Author
- License
Status
This Nginx module is currently considered experimental. Issues and PRs are welcome if you encounter any problems.
Synopsis
http {
compression_normalize_accept_encoding gzip,br,zstd gzip,br zstd br gzip;
server {
listen 80;
server_name example.com;
location / {
# Your configurations
}
}
}
Directives
compression_normalize_accept_encoding
Syntax: compression_normalize_accept_encoding combinations1 [combinations2 ..] | off;
Default: compression_normalize_accept_encoding off;
Context: http, server, location
Enables the normalization of the Accept-Encoding header by specifying preferred combinations of compression algorithms. This directive accepts a list of compression methods, allowing to define the order and priority of encoding types that the server should prefer when responding to client requests.
For example, with the following configuration
compression_normalize_accept_encoding gzip,br,zstd gzip,br zstd br gzip;
If the request header Accept-Encoding contains gzip, br and zstd at the same time, the value of the standardized Accept-Encoding header is gzip,br,zstd. If the above conditions are not met, but the request header contains gzip and br, the value of the standardized Accept-Encoding header is gzip,br. And so on, until all the combinations given by the compression_normalize_accept_encoding directive are checked. If no combination is hit at this time, the Accept-Encoding header is directly deleted.
A value of off will disable this feature.
Variables
\$compression_original_accept_encoding
keeps the original value of request Accept-Encoding header.