This module is contained in the mod_ext_filter.c
file, with
Apache 2.0 and later. It provides the ability to pass the response body
through an external program before delivering to the client.
mod_ext_filter
is not compiled into the server by default.
This is an experimental module and should be used with
care. Test your mod_ext_filter
configuration carefully to
ensure that it performs the desired function. You may wish to review
XXX for background on the Apache filtering model.
mod_ext_filter
presents a simple and familiar programming
model for filters. With this module, a program which reads from stdin and
writes to stdout (i.e., a Unix-style filter command) can be a filter for
Apache. This filtering mechanism is much slower than using a filter which
is specially written for the Apache API and runs inside of the Apache
server process, but it does have the following benefits:
Even when the performance characteristics are not suitable for production
use, mod_ext_filter
can be used as a prototype environment
for filters.
Syntax: ExtFilterDefine filtername parameters
Default: None
Context: server
Override: none
Status: Experimental
Module: mod_ext_filter
Compatibility: Only available in Apache 2.0 or later
The ExtFilterDefine
directive defines the characteristics of
an external filter, including the program to run and its arguments.
filtername specifies the name of the filter being defined. This name can then be used in AddOutputFilter directives. It must be unique among all registered filters. At the present time, no error is reported by the register-filter API, so a problem with duplicate names isn't reported to the user.
Subsequent parameters can appear in any order and define the external command to run and certain other characteristics. The only required parameter is cmd=. These parameters are:
intype=
is specified,
the filter will be disabled for documents of other types.
Syntax: ExtFilterOptions option option ...
Default: DebugLevel=0 NoLogStderr
Context: directory
Override: none
Status: Experimental
Module: mod_ext_filter
Compatibility: Only available in Apache 2.0 or later
The ExtFilterOptions
directive specifies special processing
options for mod_ext_filter
. Option can be one of
mod_ext_filter
. By default, no
debug messages are generated. This is equivalent to
DebugLevel=0. With higher numbers, more debug messages are
generated, and server performance will be degraded. The actual meanings
of the numeric values are described with the definitions of the DBGLVL_
constants near the beginning of mod_ext_filter.c
.
Note: The core directive LogLevel should be used to cause debug messages to be stored in the Apache error log.
ExtFilterOptions LogStderr DebugLevel=0Messages written to the filter's standard error will be stored in the Apache error log. No debug messages will be generated by
mod_ext_filter
.
# mod_ext_filter directive to define a filter to HTML-ize text/c files # using the external program /usr/bin/enscript, with the type of the # result set to text/html ExtFilterDefine c-to-html mode=output intype=text/c outtype=text/html \ cmd="/usr/bin/enscript --color -W html -Ec -o - -" <Directory "/export/home/trawick/apacheinst/htdocs/c"> # core directive to cause the new filter to be run on output AddOutputFilter c-to-heml # mod_mime directive to set the type of .c files to text/c AddType text/c .c # mod_ext_filter directive to set the debug level just high # enough to see a log message per request showing the configuration # in force ExtFilterOptions DebugLevel=1 </Directory>
# mod_ext_filter directive to define the external filter ExtFilterDefine gzip mode=output cmd=/bin/gzip <Location /gzipped> # core directive to cause the gzip filter to be run on output AddOutputFilter gzip # mod_header directive to add "Content-Encoding: gzip" header field Header set Content-Encoding gzip </Location>
# mod_ext_filter directive to define a filter which runs everything # through cat; cat doesn't modify anything; it just introduces extra # pathlength and consumes more resources ExtFilterDefine slowdown mode=output cmd=/bin/cat preservescontentlength <Location /> # core directive to cause the slowdown filter to be run several times on # output AddOutputFilter slowdown slowdown slowdown </Location>