<-
Apache > HTTP Server > Documentation > Version 2.4 > Modules

Apache Module mod_deflate

Available Languages:  en  |  fr  |  ja  |  ko 

Description:Compress content before it is delivered to the client
Status:Extension
Module Identifier:deflate_module
Source File:mod_deflate.c

Summary

The mod_deflate module provides the DEFLATE output filter that allows output from your server to be compressed before being sent to the client over the network.

Support Apache!

Topics

Directives

Bugfix checklist

See also

top

Supported Encodings

The gzip encoding is the only one supported to ensure complete compatibility with old browser implementations. The deflate encoding is not supported, please check the zlib's documentation for a complete explanation.

top

Sample Configurations

Compression and TLS

Some web applications are vulnerable to an information disclosure attack when a TLS connection carries deflate compressed data. For more information, review the details of the "BREACH" family of attacks.

This is a simple configuration that compresses common text-based content types.

Compress only a few types

AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript
top

Enabling Compression

Compression and TLS

Some web applications are vulnerable to an information disclosure attack when a TLS connection carries deflate compressed data. For more information, review the details of the "BREACH" family of attacks.

Output Compression

Compression is implemented by the DEFLATE filter. The following directive will enable compression for documents in the container where it is placed:

SetOutputFilter DEFLATE
SetEnvIfNoCase Request_URI "\.(?:gif|jpe?g|png)$" no-gzip

If you want to restrict the compression to particular MIME types in general, you may use the