Understanding Apache 2 Filters


<Directory /usr/local/apache/htdocs/> SetOutputFilter INCLUDES;PHP </Directory> AddOutputFilter INCLUDES .inc .shtml


You can think about the filtering architecture in Apache as a factory assembly line. Filters are workers in the factory, and requests and responses are the items traveling in the line. Each filter processes the content and passes the result to the next filter. Filters can process the information in a variety of ways, and a number of Apache modules are implemented as filters, such as SSL, Server Side Includes, and compression. Filters can be automatically added by modules at runtime or set up in the configuration file. This example shows how to use SetOutputFilter to add two filters to all documents under a particular directory and AddOutputFilter to associate filters with particular file extensions. Additionally, AddOutputFilterByType can be used to associate filters with specific file types.

If several directives, such as AddOutputFilter and SetOutputFilter, apply to the same file, the filter lists from both directives will be merged. Input filters can be configured via the AddInputFilter, AddInputFilterBytype, and SetInputFilter directives, which have identical syntax to their output filter counterparts.

Apache 2.1/2.2 includes mod_filter, which provides increased flexibility in defining and manipulating filter chains. This can be done, for example, based on the existence of a particular HTTP header or environment variable.




Apache(c) Phrase Book(c) Essential Code and Commands
Apache Phrasebook
ISBN: 0672328364
EAN: 2147483647
Year: 2006
Pages: 254

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net