Skip to Content
Apache: The Definitive Guide, 3rd Edition
book

Apache: The Definitive Guide, 3rd Edition

by Ben Laurie, Peter Laurie
December 2002
Intermediate to advanced
588 pages
25h 57m
English
O'Reilly Media, Inc.
Content preview from Apache: The Definitive Guide, 3rd Edition

Filters

Apache v2 introduced a new mechanism called a “Filter”, together with a reworking of Multiviews. The documentation says:

A filter is a process which is applied to data that is sent or received by the server. Data sent by clients to the server is processed by input filters while data sent by the server to the client is processed by output filters. Multiple filters can be applied to the data, and the order of the filters can be explicitly specified.

Filters are used internally by Apache to perform functions such as chunking and byte-range request handling. In addition, modules can provide filters which are selectable using run-time configuration directives. The set of filters which apply to data can be manipulated with the SetInputFilter and SetOutputFilter directives.

The only configurable filter currently included with the Apache distribution is the INCLUDES filter which is provided by mod_include to process output for Server Side Includes. There is also an experimental module called mod_ext_filter which allows for external programs to be defined as filters.

There is a demonstration filter that changes text to uppercase. In .../site.filter/htdocs we have two files, 1.txt and 1.html, which have the same contents:

HULLO WORLD FROM site.filter

The Config file is as follows:

User webuser
Group webgroup

Listen 80
ServerName my586

AddOutputFilter CaseFilter html
DocumentRoot /usr/www/APACHE3/site.filter/htdocs

If we visit the site, we are offered a directory. If we choose 1.txt

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Tomcat: The Definitive Guide, 2nd Edition

Tomcat: The Definitive Guide, 2nd Edition

Jason Brittain, Ian F. Darwin
HTTP: The Definitive Guide

HTTP: The Definitive Guide

David Gourley, Brian Totty, Marjorie Sayer, Anshu Aggarwal, Sailu Reddy
Nginx HTTP Server - Fourth Edition

Nginx HTTP Server - Fourth Edition

Martin Bjerretoft Fjordvald, Nedelcu

Publisher Resources

ISBN: 0596002033Supplemental ContentErrata Page