switch to a 60 bit hash
[httpd-crcsyncproxy.git] / docs / manual / filter.html.en
blob737e08fce1388fdaa169423718e2249dfaf8b819
1 <?xml version="1.0" encoding="ISO-8859-1"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
4 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
5 This file is generated from xml source: DO NOT EDIT
6 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
7 -->
8 <title>Filters - Apache HTTP Server</title>
9 <link href="./style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
10 <link href="./style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
11 <link href="./style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" />
12 <link href="./images/favicon.ico" rel="shortcut icon" /></head>
13 <body id="manual-page"><div id="page-header">
14 <p class="menu"><a href="./mod/">Modules</a> | <a href="./mod/directives.html">Directives</a> | <a href="./faq/">FAQ</a> | <a href="./glossary.html">Glossary</a> | <a href="./sitemap.html">Sitemap</a></p>
15 <p class="apache">Apache HTTP Server Version 2.3</p>
16 <img alt="" src="./images/feather.gif" /></div>
17 <div class="up"><a href="./"><img title="&lt;-" alt="&lt;-" src="./images/left.gif" /></a></div>
18 <div id="path">
19 <a href="http://www.apache.org/">Apache</a> &gt; <a href="http://httpd.apache.org/">HTTP Server</a> &gt; <a href="http://httpd.apache.org/docs/">Documentation</a> &gt; <a href="./">Version 2.3</a></div><div id="page-content"><div id="preamble"><h1>Filters</h1>
20 <div class="toplang">
21 <p><span>Available Languages: </span><a href="./en/filter.html" title="English">&nbsp;en&nbsp;</a> |
22 <a href="./es/filter.html" hreflang="es" rel="alternate" title="Español">&nbsp;es&nbsp;</a> |
23 <a href="./fr/filter.html" hreflang="fr" rel="alternate" title="Français">&nbsp;fr&nbsp;</a> |
24 <a href="./ja/filter.html" hreflang="ja" rel="alternate" title="Japanese">&nbsp;ja&nbsp;</a> |
25 <a href="./ko/filter.html" hreflang="ko" rel="alternate" title="Korean">&nbsp;ko&nbsp;</a> |
26 <a href="./tr/filter.html" hreflang="tr" rel="alternate" title="Türkçe">&nbsp;tr&nbsp;</a></p>
27 </div>
29 <p>This document describes the use of filters in Apache.</p>
30 </div>
31 <div id="quickview"><ul id="toc"><li><img alt="" src="./images/down.gif" /> <a href="#intro">Filtering in Apache 2</a></li>
32 <li><img alt="" src="./images/down.gif" /> <a href="#smart">Smart Filtering</a></li>
33 <li><img alt="" src="./images/down.gif" /> <a href="#using">Using Filters</a></li>
34 </ul></div>
35 <div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div>
36 <div class="section">
37 <h2><a name="intro" id="intro">Filtering in Apache 2</a></h2>
39 <table class="related"><tr><th>Related Modules</th><th>Related Directives</th></tr><tr><td><ul><li><code class="module"><a href="./mod/mod_filter.html">mod_filter</a></code></li><li><code class="module"><a href="./mod/mod_deflate.html">mod_deflate</a></code></li><li><code class="module"><a href="./mod/mod_ext_filter.html">mod_ext_filter</a></code></li><li><code class="module"><a href="./mod/mod_include.html">mod_include</a></code></li><li><code class="module"><a href="./mod/mod_charset_lite.html">mod_charset_lite</a></code></li></ul></td><td><ul><li><code class="directive"><a href="./mod/mod_filter.html#filterchain">FilterChain</a></code></li><li><code class="directive"><a href="./mod/mod_filter.html#filterdeclare">FilterDeclare</a></code></li><li><code class="directive"><a href="./mod/mod_filter.html#filterprotocol">FilterProtocol</a></code></li><li><code class="directive"><a href="./mod/mod_filter.html#filterprovider">FilterProvider</a></code></li><li><code class="directive"><a href="./mod/mod_mime.html#addinputfilter">AddInputFilter</a></code></li><li><code class="directive"><a href="./mod/mod_mime.html#addoutputfilter">AddOutputFilter</a></code></li><li><code class="directive"><a href="./mod/mod_mime.html#removeinputfilter">RemoveInputFilter</a></code></li><li><code class="directive"><a href="./mod/mod_mime.html#removeoutputfilter">RemoveOutputFilter</a></code></li><li><code class="directive"><a href="./mod/mod_ext_filter.html#extfilterdefine">ExtFilterDefine</a></code></li><li><code class="directive"><a href="./mod/mod_ext_filter.html#extfilteroptions">ExtFilterOptions</a></code></li><li><code class="directive"><a href="./mod/core.html#setinputfilter">SetInputFilter</a></code></li><li><code class="directive"><a href="./mod/core.html#setoutputfilter">SetOutputFilter</a></code></li></ul></td></tr></table>
41 <p>The Filter Chain is available in Apache 2.0 and higher,
42 and enables applications to process incoming and outgoing data
43 in a highly flexible and configurable manner, regardless of
44 where the data comes from. We can pre-process incoming data,
45 and post-process outgoing data, at will. This is basically
46 independent of the traditional request processing phases.</p>
47 <p class="figure">
48 <img src="images/filter_arch.png" width="569" height="392" alt="Filters can be chained, in a Data Axis orthogonal to request processing" />
49 </p>
50 <p>Some examples of filtering in the standard Apache distribution are:</p>
51 <ul>
52 <li><code class="module"><a href="./mod/mod_include.html">mod_include</a></code>, implements server-side includes.</li>
53 <li><code class="module"><a href="./mod/mod_ssl.html">mod_ssl</a></code>, implements SSL encryption (https).</li>
54 <li><code class="module"><a href="./mod/mod_deflate.html">mod_deflate</a></code>, implements compression/decompression on the fly.</li>
55 <li><code class="module"><a href="./mod/mod_charset_lite.html">mod_charset_lite</a></code>, transcodes between different character sets.</li>
56 <li><code class="module"><a href="./mod/mod_ext_filter.html">mod_ext_filter</a></code>, runs an external program as a filter.</li>
57 </ul>
58 <p>Apache also uses a number of filters internally to perform
59 functions like chunking and byte-range handling.</p>
61 <p>A wider range of applications are implemented by third-party filter
62 modules available from <a href="http://modules.apache.org/">modules.apache.org</a> and
63 elsewhere. A few of these are:</p>
65 <ul>
66 <li>HTML and XML processing and rewriting</li>
67 <li>XSLT transforms and XIncludes</li>
68 <li>XML Namespace support</li>
69 <li>File Upload handling and decoding of HTML Forms</li>
70 <li>Image processing</li>
71 <li>Protection of vulnerable applications such as PHP scripts</li>
72 <li>Text search-and-replace editing</li>
73 </ul>
74 </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div>
75 <div class="section">
76 <h2><a name="smart" id="smart">Smart Filtering</a></h2>
78 <p class="figure">
79 <img src="images/mod_filter_new.png" width="423" height="331" alt="Smart filtering applies different filter providers according to the state of request processing" />
80 </p>
81 <p><code class="module"><a href="./mod/mod_filter.html">mod_filter</a></code>, included in Apache 2.1 and later,
82 enables the filter chain to be configured dynamically at run time.
83 So for example you can set up a proxy to rewrite
84 HTML with an HTML filter and JPEG images with a completely
85 separate filter, despite the proxy having no prior information
86 about what the origin server will send. This works by using a
87 filter harness, that dispatches to different providers according
88 to the actual contents at runtime. Any filter may be either
89 inserted directly in the chain and run unconditionally, or
90 used as a provider and inserted dynamically. For example,</p>
91 <ul>
92 <li>an HTML processing filter will only run if the content is
93 text/html or application/xhtml+xml</li>
94 <li>A compression filter will only run if the input is a
95 compressible type and not already compressed</li>
96 <li>A charset conversion filter will be inserted if a text
97 document is not already in the desired charset</li>
98 </ul>
99 </div><div class="top"><a href="#page-header"><img alt="top" src="./images/up.gif" /></a></div>
100 <div class="section">
101 <h2><a name="using" id="using">Using Filters</a></h2>
103 <p>There are two ways to use filtering: Simple and Dynamic.
104 In general, you should use one or the other; mixing them can
105 have unexpected consequences (although simple Input filtering
106 can be mixed freely with either simple or dynamic Output filtering).</p>
107 <p>The Simple Way is the only way to configure input filters, and is
108 sufficient for output filters where you need a static filter chain.
109 Relevant directives are
110 <code class="directive"><a href="./mod/core.html#setinputfilter">SetInputFilter</a></code>,
111 <code class="directive"><a href="./mod/core.html#setoutputfilter">SetOutputFilter</a></code>,
112 <code class="directive"><a href="./mod/mod_mime.html#addinputfilter">AddInputFilter</a></code>,
113 <code class="directive"><a href="./mod/mod_mime.html#addoutputfilter">AddOutputFilter</a></code>,
114 <code class="directive"><a href="./mod/mod_mime.html#removeinputfilter">RemoveInputFilter</a></code>, and
115 <code class="directive"><a href="./mod/mod_mime.html#removeoutputfilter">RemoveOutputFilter</a></code>.</p>
117 <p>The Dynamic Way enables both static and flexible, dynamic configuration
118 of output filters, as discussed in the <code class="module"><a href="./mod/mod_filter.html">mod_filter</a></code> page.
119 Relevant directives are
120 <code class="directive"><a href="./mod/mod_filter.html#filterchain">FilterChain</a></code>,
121 <code class="directive"><a href="./mod/mod_filter.html#filterdeclare">FilterDeclare</a></code>, and
122 <code class="directive"><a href="./mod/mod_filter.html#filterprovider">FilterProvider</a></code>.</p>
124 <p>One further directive <code class="directive"><a href="./mod/core.html#addoutputfilterbytype">AddOutputFilterByType</a></code> is still supported,
125 but may be problematic and is now deprecated. Use dynamic
126 configuration instead.</p>
128 </div></div>
129 <div class="bottomlang">
130 <p><span>Available Languages: </span><a href="./en/filter.html" title="English">&nbsp;en&nbsp;</a> |
131 <a href="./es/filter.html" hreflang="es" rel="alternate" title="Español">&nbsp;es&nbsp;</a> |
132 <a href="./fr/filter.html" hreflang="fr" rel="alternate" title="Français">&nbsp;fr&nbsp;</a> |
133 <a href="./ja/filter.html" hreflang="ja" rel="alternate" title="Japanese">&nbsp;ja&nbsp;</a> |
134 <a href="./ko/filter.html" hreflang="ko" rel="alternate" title="Korean">&nbsp;ko&nbsp;</a> |
135 <a href="./tr/filter.html" hreflang="tr" rel="alternate" title="Türkçe">&nbsp;tr&nbsp;</a></p>
136 </div><div id="footer">
137 <p class="apache">Copyright 2009 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
138 <p class="menu"><a href="./mod/">Modules</a> | <a href="./mod/directives.html">Directives</a> | <a href="./faq/">FAQ</a> | <a href="./glossary.html">Glossary</a> | <a href="./sitemap.html">Sitemap</a></p></div>
139 </body></html>