Chapter 7. Filters

Filters are a mechanism introduced in Apache 2.0 to preprocess client POST data before it is seen by the content handler, and to postprocess the output from the handler before it is sent back to the client. Filters can be chained and can modify the metainformation as well as the data itself. They can be used explicitly and are also used internally by Apache, for example, for implementing SSL encryption. Table 7-1 lists the filters provided by standard Apache modules.

Table 7-1. Standard built-in filters

Filter name

Module

Description

DEFLATE

mod_deflate

Output compression

INFLATE

mod_deflate

Input uncompression

INCLUDES

mod_include

SSI processing

SUBSTITUTE

mod_substitute

Response body substitutions

Simple Filter Configuration

Filters can be configured statically in mod_mime, which may be appropriate if the filtering requirements for a resource always remain the same.

AddInputFilter

SVDH* (FileInfo)

mod_mime (B)

OFF

AddInputFilter filter[;filter ...] ext ...

Compatibility: 2.0.26 and later

Maps each of the extensions to the input filter specified in the semicolon-separated filter list.

AddOutputFilter

SVDH* (FileInfo)

mod_mime (B)

OFF

AddOutputFilter filter[;filter ...] ext ...

Compatibility: 2.0.26 and later

Maps each of the extensions to the output filter specified in the semicolon-separated filter list.

RemoveInputFilter

VDH* (FileInfo)

mod_mime (B)

RemoveInputFilter ext ...

Compatibility: 2.0.26 and later

Removes any input filter associations for files with the specified extensions.

RemoveOutputFilter ...

Get Apache 2 Pocket Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.