Apache HTTP Server Version 2.4
This document describes the use of Apache's Handlers.
|Related Modules||Related Directives|
A "handler" is an internal Apache representation of the action to be performed when a file is called. Generally, files have implicit handlers, based on the file type. Normally, all files are simply served by the server, but certain file types are "handled" separately.
Handlers may also be configured explicitly, based on either filename extensions or on location, without relation to file type. This is advantageous both because it is a more elegant solution, and because it also allows for both a type and a handler to be associated with a file. (See also Files with Multiple Extensions.)
Handlers can either be built into the server or included in
a module, or they can be added with the
Action directive. The
built-in handlers in the standard distribution are as
default_handler(), which is the handler used by default to handle static content. (core)
The following directives will cause requests for files with
html extension to trigger the launch of the
footer.pl CGI script.
Action add-footer /cgi-bin/footer.pl AddHandler add-footer .html
Then the CGI script is responsible for sending the
originally requested document (pointed to by the
PATH_TRANSLATED environment variable) and making
whatever modifications or additions are desired.
The following directives will enable the
send-as-is handler, which is used for files which
contain their own HTTP headers. All files in the
/web/htdocs/asis/ directory will be processed by
send-as-is handler, regardless of their
<Directory "/web/htdocs/asis"> SetHandler send-as-is </Directory>
In order to implement the handler features, an addition has
been made to the Apache API that
you may wish to make use of. Specifically, a new record has
been added to the
If you wish to have your module engage a handler, you need
only to set
r->handler to the name of the
handler at any time prior to the
stage of the request. Handlers are implemented as they were
before, albeit using the handler name instead of a content
type. While it is not necessary, the naming convention for
handlers is to use a dash-separated word, with no slashes, so
as to not invade the media type name-space.