]> granicus.if.org Git - apache/blob - docs/manual/mod/mod_filter.html.en
Documentation rebuild after recent commits
[apache] / docs / manual / mod / mod_filter.html.en
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 <meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type" />
5 <!--
6         XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
7               This file is generated from xml source: DO NOT EDIT
8         XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
9       -->
10 <title>mod_filter - Apache HTTP Server Version 2.5</title>
11 <link href="../style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
12 <link href="../style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
13 <link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" /><link rel="stylesheet" type="text/css" href="../style/css/prettify.css" />
14 <script src="../style/scripts/prettify.min.js" type="text/javascript">
15 </script>
16
17 <link href="../images/favicon.ico" rel="shortcut icon" /></head>
18 <body>
19 <div id="page-header">
20 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/quickreference.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p>
21 <p class="apache">Apache HTTP Server Version 2.5</p>
22 <img alt="" src="../images/feather.png" /></div>
23 <div class="up"><a href="./"><img title="&lt;-" alt="&lt;-" src="../images/left.gif" /></a></div>
24 <div id="path">
25 <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.5</a> &gt; <a href="./">Modules</a></div>
26 <div id="page-content">
27 <div id="preamble"><h1>Apache Module mod_filter</h1>
28 <div class="toplang">
29 <p><span>Available Languages: </span><a href="../en/mod/mod_filter.html" title="English">&nbsp;en&nbsp;</a></p>
30 </div>
31 <table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>Context-sensitive smart filter configuration module</td></tr>
32 <tr><th><a href="module-dict.html#Status">Status:</a></th><td>Base</td></tr>
33 <tr><th><a href="module-dict.html#ModuleIdentifier">Module Identifier:</a></th><td>filter_module</td></tr>
34 <tr><th><a href="module-dict.html#SourceFile">Source File:</a></th><td>mod_filter.c</td></tr></table>
35 <h3>Summary</h3>
36
37     <p>This module enables smart, context-sensitive configuration of
38     output content filters.  For example, apache can be configured to
39     process different content-types through different filters, even
40     when the content-type is not known in advance (e.g. in a proxy).</p>
41
42     <p><code class="module"><a href="../mod/mod_filter.html">mod_filter</a></code> works by introducing indirection into
43     the filter chain.  Instead of inserting filters in the chain, we insert
44     a filter harness which in turn dispatches conditionally
45     to a filter provider.  Any content filter may be used as a provider
46     to <code class="module"><a href="../mod/mod_filter.html">mod_filter</a></code>; no change to existing filter modules is
47     required (although it may be possible to simplify them).</p>
48 </div>
49 <div id="quickview"><h3>Topics</h3>
50 <ul id="topics">
51 <li><img alt="" src="../images/down.gif" /> <a href="#smart">Smart Filtering</a></li>
52 <li><img alt="" src="../images/down.gif" /> <a href="#terms">Filter Declarations, Providers and Chains</a></li>
53 <li><img alt="" src="../images/down.gif" /> <a href="#config">Configuring the Chain</a></li>
54 <li><img alt="" src="../images/down.gif" /> <a href="#errordocs">Filtering and Response Status</a></li>
55 <li><img alt="" src="../images/down.gif" /> <a href="#upgrade">Upgrading from Apache HTTP Server 2.2 Configuration</a></li>
56 <li><img alt="" src="../images/down.gif" /> <a href="#examples">Examples</a></li>
57 <li><img alt="" src="../images/down.gif" /> <a href="#protocol">Protocol Handling</a></li>
58 </ul><h3 class="directives">Directives</h3>
59 <ul id="toc">
60 <li><img alt="" src="../images/down.gif" /> <a href="#addoutputfilterbytype">AddOutputFilterByType</a></li>
61 <li><img alt="" src="../images/down.gif" /> <a href="#filterchain">FilterChain</a></li>
62 <li><img alt="" src="../images/down.gif" /> <a href="#filterdeclare">FilterDeclare</a></li>
63 <li><img alt="" src="../images/down.gif" /> <a href="#filterprotocol">FilterProtocol</a></li>
64 <li><img alt="" src="../images/down.gif" /> <a href="#filterprovider">FilterProvider</a></li>
65 <li><img alt="" src="../images/down.gif" /> <a href="#filtertrace">FilterTrace</a></li>
66 </ul>
67 <h3>Bugfix checklist</h3><ul class="seealso"><li><a href="https://www.apache.org/dist/httpd/CHANGES_2.4">httpd changelog</a></li><li><a href="https://bz.apache.org/bugzilla/buglist.cgi?bug_status=__open__&amp;list_id=144532&amp;product=Apache%20httpd-2&amp;query_format=specific&amp;order=changeddate%20DESC%2Cpriority%2Cbug_severity&amp;component=mod_filter">Known issues</a></li><li><a href="https://bz.apache.org/bugzilla/enter_bug.cgi?product=Apache%20httpd-2&amp;component=mod_filter">Report a bug</a></li></ul><h3>See also</h3>
68 <ul class="seealso">
69 <li><a href="#comments_section">Comments</a></li></ul></div>
70 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
71 <div class="section">
72 <h2><a name="smart" id="smart">Smart Filtering</a></h2>
73     <p>In the traditional filtering model, filters are inserted unconditionally
74     using <code class="directive"><a href="../mod/mod_mime.html#addoutputfilter">AddOutputFilter</a></code> and family.
75     Each filter then needs to determine whether to run, and there is little
76     flexibility available for server admins to allow the chain to be
77     configured dynamically.</p>
78
79     <p><code class="module"><a href="../mod/mod_filter.html">mod_filter</a></code> by contrast gives server administrators a
80     great deal of flexibility in configuring the filter chain.  In fact,
81     filters can be inserted based on complex boolean
82     <a href="../expr.html">expressions</a> This generalises the limited
83     flexibility offered by <code class="directive">AddOutputFilterByType</code>.</p>
84 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
85 <div class="section">
86 <h2><a name="terms" id="terms">Filter Declarations, Providers and Chains</a></h2>
87     <p class="figure">
88     <img src="../images/mod_filter_old.gif" width="160" height="310" alt="[This image displays the traditional filter model]" /><br />
89     <dfn>Figure 1:</dfn> The traditional filter model</p>
90
91     <p>In the traditional model, output filters are a simple chain
92     from the content generator (handler) to the client.  This works well
93     provided the filter chain can be correctly configured, but presents
94     problems when the filters need to be configured dynamically based on
95     the outcome of the handler.</p>
96
97     <p class="figure">
98     <img src="../images/mod_filter_new.gif" width="423" height="331" alt="[This image shows the mod_filter model]" /><br />
99     <dfn>Figure 2:</dfn> The <code class="module"><a href="../mod/mod_filter.html">mod_filter</a></code> model</p>
100
101     <p><code class="module"><a href="../mod/mod_filter.html">mod_filter</a></code> works by introducing indirection into
102     the filter chain.  Instead of inserting filters in the chain, we insert
103     a filter harness which in turn dispatches conditionally
104     to a filter provider.  Any content filter may be used as a provider
105     to <code class="module"><a href="../mod/mod_filter.html">mod_filter</a></code>; no change to existing filter modules
106     is required (although it may be possible to simplify them).  There can be
107     multiple providers for one filter, but no more than one provider will
108     run for any single request.</p>
109
110     <p>A filter chain comprises any number of instances of the filter
111     harness, each of which may have any number of providers.  A special
112     case is that of a single provider with unconditional dispatch: this
113     is equivalent to inserting the provider filter directly into the chain.</p>
114 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
115 <div class="section">
116 <h2><a name="config" id="config">Configuring the Chain</a></h2>
117     <p>There are three stages to configuring a filter chain with
118     <code class="module"><a href="../mod/mod_filter.html">mod_filter</a></code>. For details of the directives, see below.</p>
119
120     <dl>
121     <dt>Declare Filters</dt>
122     <dd>The <code class="directive"><a href="#filterdeclare">FilterDeclare</a></code> directive
123     declares a filter, assigning it a name and filter type.  Required
124     only if the filter is not the default type AP_FTYPE_RESOURCE.</dd>
125
126     <dt>Register Providers</dt>
127     <dd>The <code class="directive"><a href="#filterprovider">FilterProvider</a></code>
128     directive registers a provider with a filter. The filter may have
129     been declared with <code class="directive"><a href="#filterdeclare">FilterDeclare</a></code>; if not, FilterProvider will implicitly
130     declare it with the default type AP_FTYPE_RESOURCE. The provider
131     must have been
132     registered with <code>ap_register_output_filter</code> by some module.
133     The final argument to <code class="directive"><a href="#filterprovider">FilterProvider</a></code> is an expression: the provider will be
134     selected to run for a request if and only if the expression evaluates
135     to true.  The expression may evaluate HTTP request or response
136     headers, environment variables, or the Handler used by this request.
137     Unlike earlier versions, mod_filter now supports complex expressions
138     involving multiple criteria with AND / OR logic (&amp;&amp; / ||)
139     and brackets. The details of the expression syntax are described in
140     the <a href="../expr.html">ap_expr documentation</a>.</dd>
141
142     <dt>Configure the Chain</dt>
143     <dd>The above directives build components of a smart filter chain,
144     but do not configure it to run.  The <code class="directive"><a href="#filterchain">FilterChain</a></code> directive builds a filter chain from smart
145     filters declared, offering the flexibility to insert filters at the
146     beginning or end of the chain, remove a filter, or clear the chain.</dd>
147 </dl>
148 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
149 <div class="section">
150 <h2><a name="errordocs" id="errordocs">Filtering and Response Status</a></h2>
151     <p>mod_filter normally only runs filters on responses with
152     HTTP status 200 (OK).  If you want to filter documents with
153     other response statuses, you can set the <var>filter-errordocs</var>
154     environment variable, and it will work on all responses
155     regardless of status.  To refine this further, you can use
156     expression conditions with <code class="directive">FilterProvider</code>.</p>
157 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
158 <div class="section">
159 <h2><a name="upgrade" id="upgrade">Upgrading from Apache HTTP Server 2.2 Configuration</a></h2>
160     <p>The <code class="directive"><a href="#filterprovider">FilterProvider</a></code>
161     directive has changed from httpd 2.2: the <var>match</var> and
162     <var>dispatch</var> arguments are replaced with a single but
163     more versatile <var>expression</var>.  In general, you can convert
164     a match/dispatch pair to the two sides of an expression, using
165     something like:</p>
166     <div class="example"><p><code>"dispatch = 'match'"</code></p></div>
167     <p>The Request headers, Response headers and Environment variables
168     are now interpreted from syntax <var>%{req:foo}</var>,
169     <var>%{resp:foo}</var> and <var>%{env:foo}</var> respectively.
170     The variables <var>%{HANDLER}</var> and <var>%{CONTENT_TYPE}</var>
171     are also supported.</p>
172     <p>Note that the match no longer support substring matches.  They can be
173     replaced by regular expression matches.</p>
174 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
175 <div class="section">
176 <h2><a name="examples" id="examples">Examples</a></h2>
177     <dl>
178     <dt>Server side Includes (SSI)</dt>
179     <dd>A simple case of replacing <code class="directive">AddOutputFilterByType</code>
180     <pre class="prettyprint lang-config">FilterDeclare SSI
181 FilterProvider SSI INCLUDES "%{CONTENT_TYPE} =~ m|^text/html|"
182 FilterChain SSI</pre>
183
184     </dd>
185
186     <dt>Server side Includes (SSI)</dt>
187     <dd>The same as the above but dispatching on handler (classic
188     SSI behaviour; .shtml files get processed).
189     <pre class="prettyprint lang-config">FilterProvider SSI INCLUDES "%{HANDLER} = 'server-parsed'"
190 FilterChain SSI</pre>
191
192     </dd>
193
194     <dt>Emulating mod_gzip with mod_deflate</dt>
195     <dd>Insert INFLATE filter only if "gzip" is NOT in the
196     Accept-Encoding header.  This filter runs with ftype CONTENT_SET.
197     <pre class="prettyprint lang-config">FilterDeclare gzip CONTENT_SET
198 FilterProvider gzip inflate "%{req:Accept-Encoding} !~ /gzip/"
199 FilterChain gzip</pre>
200
201     </dd>
202
203     <dt>Image Downsampling</dt>
204     <dd>Suppose we want to downsample all web images, and have filters
205     for GIF, JPEG and PNG.
206     <pre class="prettyprint lang-config">FilterProvider unpack jpeg_unpack "%{CONTENT_TYPE} = 'image/jpeg'"
207 FilterProvider unpack gif_unpack "%{CONTENT_TYPE} = 'image/gif'"
208 FilterProvider unpack png_unpack "%{CONTENT_TYPE} = 'image/png'"
209
210 FilterProvider downsample downsample_filter "%{CONTENT_TYPE} = m|^image/(jpeg|gif|png)|"
211 FilterProtocol downsample "change=yes"
212
213 FilterProvider repack jpeg_pack "%{CONTENT_TYPE} = 'image/jpeg'"
214 FilterProvider repack gif_pack "%{CONTENT_TYPE} = 'image/gif'"
215 FilterProvider repack png_pack "%{CONTENT_TYPE} = 'image/png'"
216 &lt;Location "/image-filter"&gt;
217     FilterChain unpack downsample repack
218 &lt;/Location&gt;</pre>
219
220     </dd>
221     </dl>
222 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
223 <div class="section">
224 <h2><a name="protocol" id="protocol">Protocol Handling</a></h2>
225     <p>Historically, each filter is responsible for ensuring that whatever
226     changes it makes are correctly represented in the HTTP response headers,
227     and that it does not run when it would make an illegal change.  This
228     imposes a burden on filter authors to re-implement some common
229     functionality in every filter:</p>
230
231     <ul>
232     <li>Many filters will change the content, invalidating existing content
233     tags, checksums, hashes, and lengths.</li>
234
235     <li>Filters that require an entire, unbroken response in input need to
236     ensure they don't get byteranges from a backend.</li>
237
238     <li>Filters that transform output in a filter need to ensure they don't
239     violate a <code>Cache-Control: no-transform</code> header from the
240     backend.</li>
241
242     <li>Filters may make responses uncacheable.</li>
243     </ul>
244
245     <p><code class="module"><a href="../mod/mod_filter.html">mod_filter</a></code> aims to offer generic handling of these
246     details of filter implementation, reducing the complexity required of
247     content filter modules. This is work-in-progress; the
248     <code class="directive"><a href="#filterprotocol">FilterProtocol</a></code> implements
249     some of this functionality for back-compatibility with Apache 2.0
250     modules.  For httpd 2.1 and later, the
251     <code>ap_register_output_filter_protocol</code> and
252     <code>ap_filter_protocol</code> API enables filter modules to
253     declare their own behaviour.</p>
254
255     <p>At the same time, <code class="module"><a href="../mod/mod_filter.html">mod_filter</a></code> should not interfere
256     with a filter that wants to handle all aspects of the protocol.  By
257     default (i.e. in the absence of any <code class="directive"><a href="#filterprotocol">FilterProtocol</a></code> directives), <code class="module"><a href="../mod/mod_filter.html">mod_filter</a></code>
258     will leave the headers untouched.</p>
259
260     <p>At the time of writing, this feature is largely untested,
261     as modules in common use are designed to work with 2.0.
262     Modules using it should test it carefully.</p>
263 </div>
264 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
265 <div class="directive-section"><h2><a name="AddOutputFilterByType" id="AddOutputFilterByType">AddOutputFilterByType</a> <a name="addoutputfilterbytype" id="addoutputfilterbytype">Directive</a></h2>
266 <table class="directive">
267 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>assigns an output filter to a particular media-type</td></tr>
268 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>AddOutputFilterByType <var>filter</var>[;<var>filter</var>...]
269 <var>media-type</var> [<var>media-type</var>] ...</code></td></tr>
270 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
271 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
272 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
273 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_filter</td></tr>
274 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>Had severe limitations before
275 being moved to <code class="module"><a href="../mod/mod_filter.html">mod_filter</a></code> in version 2.3.7</td></tr>
276 </table>
277     <p>This directive activates a particular output <a href="../filter.html">filter</a> for a request depending on the
278     response <a class="glossarylink" href="../glossary.html#media-type" title="see glossary">media-type</a>.</p>
279
280     <p>The following example uses the <code>DEFLATE</code> filter, which
281     is provided by <code class="module"><a href="../mod/mod_deflate.html">mod_deflate</a></code>. It will compress all
282     output (either static or dynamic) which is labeled as
283     <code>text/html</code> or <code>text/plain</code> before it is sent
284     to the client.</p>
285
286     <pre class="prettyprint lang-config">AddOutputFilterByType DEFLATE text/html text/plain</pre>
287
288
289     <p>If you want the content to be processed by more than one filter, their
290     names have to be separated by semicolons. It's also possible to use one
291     <code class="directive">AddOutputFilterByType</code> directive for each of
292     these filters.</p>
293
294     <p>The configuration below causes all script output labeled as
295     <code>text/html</code> to be processed at first by the
296     <code>INCLUDES</code> filter and then by the <code>DEFLATE</code>
297     filter.</p>
298
299     <pre class="prettyprint lang-config">&lt;Location "/cgi-bin/"&gt;
300     Options Includes
301     AddOutputFilterByType INCLUDES;DEFLATE text/html
302 &lt;/Location&gt;</pre>
303
304
305
306 <h3>See also</h3>
307 <ul>
308 <li><code class="directive"><a href="../mod/mod_mime.html#addoutputfilter">AddOutputFilter</a></code></li>
309 <li><code class="directive"><a href="../mod/core.html#setoutputfilter">SetOutputFilter</a></code></li>
310 <li><a href="../filter.html">filters</a></li>
311 </ul>
312 </div>
313 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
314 <div class="directive-section"><h2><a name="FilterChain" id="FilterChain">FilterChain</a> <a name="filterchain" id="filterchain">Directive</a></h2>
315 <table class="directive">
316 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Configure the filter chain</td></tr>
317 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>FilterChain [+=-@!]<var>filter-name</var> <var>...</var></code></td></tr>
318 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
319 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>Options</td></tr>
320 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
321 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_filter</td></tr>
322 </table>
323     <p>This configures an actual filter chain, from declared filters.
324     <code class="directive">FilterChain</code> takes any number of arguments,
325     each optionally preceded with a single-character control that
326     determines what to do:</p>
327
328     <dl>
329     <dt><code>+<var>filter-name</var></code></dt>
330     <dd>Add <var>filter-name</var> to the end of the filter chain</dd>
331
332     <dt><code>@<var>filter-name</var></code></dt>
333     <dd>Insert <var>filter-name</var> at the start of the filter chain</dd>
334
335     <dt><code>-<var>filter-name</var></code></dt>
336     <dd>Remove <var>filter-name</var> from the filter chain</dd>
337
338     <dt><code>=<var>filter-name</var></code></dt>
339     <dd>Empty the filter chain and insert <var>filter-name</var></dd>
340
341     <dt><code>!</code></dt>
342     <dd>Empty the filter chain</dd>
343
344     <dt><code><var>filter-name</var></code></dt>
345     <dd>Equivalent to <code>+<var>filter-name</var></code></dd>
346     </dl>
347
348 </div>
349 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
350 <div class="directive-section"><h2><a name="FilterDeclare" id="FilterDeclare">FilterDeclare</a> <a name="filterdeclare" id="filterdeclare">Directive</a></h2>
351 <table class="directive">
352 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Declare a smart filter</td></tr>
353 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>FilterDeclare <var>filter-name</var> <var>[type]</var></code></td></tr>
354 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
355 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>Options</td></tr>
356 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
357 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_filter</td></tr>
358 </table>
359     <p>This directive declares an output filter together with a
360     header or environment variable that will determine runtime
361     configuration.  The first argument is a <var>filter-name</var>
362     for use in <code class="directive"><a href="#filterprovider">FilterProvider</a></code>,
363     <code class="directive"><a href="#filterchain">FilterChain</a></code> and
364     <code class="directive"><a href="#filterprotocol">FilterProtocol</a></code> directives.</p>
365
366     <p>The final (optional) argument
367     is the type of filter, and takes values of <code>ap_filter_type</code>
368     - namely <code>RESOURCE</code> (the default), <code>CONTENT_SET</code>,
369     <code>PROTOCOL</code>, <code>TRANSCODE</code>, <code>CONNECTION</code>
370     or <code>NETWORK</code>.</p>
371
372 </div>
373 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
374 <div class="directive-section"><h2><a name="FilterProtocol" id="FilterProtocol">FilterProtocol</a> <a name="filterprotocol" id="filterprotocol">Directive</a></h2>
375 <table class="directive">
376 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Deal with correct HTTP protocol handling</td></tr>
377 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>FilterProtocol <var>filter-name</var> [<var>provider-name</var>]
378     <var>proto-flags</var></code></td></tr>
379 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
380 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>Options</td></tr>
381 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
382 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_filter</td></tr>
383 </table>
384     <p>This directs <code class="module"><a href="../mod/mod_filter.html">mod_filter</a></code> to deal with ensuring the
385     filter doesn't run when it shouldn't, and that the HTTP response
386     headers are correctly set taking into account the effects of the
387     filter.</p>
388
389     <p>There are two forms of this directive.  With three arguments, it
390     applies specifically to a <var>filter-name</var> and a
391     <var>provider-name</var> for that filter.
392     With two arguments it applies to a <var>filter-name</var> whenever the
393     filter runs <em>any</em> provider.</p>
394
395     <p>Flags specified with this directive are merged with the flags
396     that underlying providers may have registerd with
397     <code class="module"><a href="../mod/mod_filter.html">mod_filter</a></code>. For example, a filter may internally specify
398     the equivalent of <code>change=yes</code>, but a particular
399     configuration of the module can override with <code>change=no</code>.
400     </p>
401
402     <p><var>proto-flags</var> is one or more of</p>
403
404     <dl>
405     <dt><code>change=yes|no</code></dt>
406     <dd>Specifies whether the filter changes the content, including possibly
407     the content length.  The "no" argument is supported in 2.4.7 and later.</dd>
408
409     <dt><code>change=1:1</code></dt>
410     <dd>The filter changes the content, but will not change the content
411     length</dd>
412
413     <dt><code>byteranges=no</code></dt>
414     <dd>The filter cannot work on byteranges and requires complete input</dd>
415
416     <dt><code>proxy=no</code></dt>
417     <dd>The filter should not run in a proxy context</dd>
418
419     <dt><code>proxy=transform</code></dt>
420     <dd>The filter transforms the response in a manner incompatible with
421     the HTTP <code>Cache-Control: no-transform</code> header.</dd>
422
423     <dt><code>cache=no</code></dt>
424     <dd>The filter renders the output uncacheable (eg by introducing randomised
425     content changes)</dd>
426     </dl>
427
428 </div>
429 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
430 <div class="directive-section"><h2><a name="FilterProvider" id="FilterProvider">FilterProvider</a> <a name="filterprovider" id="filterprovider">Directive</a></h2>
431 <table class="directive">
432 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Register a content filter</td></tr>
433 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>FilterProvider <var>filter-name</var> <var>provider-name</var>
434  <var>expression</var></code></td></tr>
435 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
436 <tr><th><a href="directive-dict.html#Override">Override:</a></th><td>Options</td></tr>
437 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
438 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_filter</td></tr>
439 </table>
440     <p>This directive registers a <em>provider</em> for the smart filter.
441     The provider will be called if and only if the <var>expression</var>
442     declared evaluates to true when the harness is first called.</p>
443
444     <p>
445     <var>provider-name</var> must have been registered by loading
446     a module that registers the name with
447     <code>ap_register_output_filter</code>.
448     </p>
449
450     <p><var>expression</var> is an
451     <a href="../expr.html">ap_expr</a>.</p>
452
453
454 <h3>See also</h3>
455 <ul>
456 <li><a href="../expr.html">Expressions in Apache HTTP Server</a>,
457 for a complete reference and examples.</li>
458 <li><code class="module"><a href="../mod/mod_include.html">mod_include</a></code></li>
459 </ul>
460 </div>
461 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
462 <div class="directive-section"><h2><a name="FilterTrace" id="FilterTrace">FilterTrace</a> <a name="filtertrace" id="filtertrace">Directive</a></h2>
463 <table class="directive">
464 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Get debug/diagnostic information from
465     <code class="module"><a href="../mod/mod_filter.html">mod_filter</a></code></td></tr>
466 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>FilterTrace <var>filter-name</var> <var>level</var></code></td></tr>
467 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
468 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Base</td></tr>
469 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_filter</td></tr>
470 </table>
471     <p>This directive generates debug information from
472     <code class="module"><a href="../mod/mod_filter.html">mod_filter</a></code>.
473     It is designed to help test and debug providers (filter modules), although
474     it may also help with <code class="module"><a href="../mod/mod_filter.html">mod_filter</a></code> itself.</p>
475
476     <p>The debug output depends on the <var>level</var> set:</p>
477     <dl>
478     <dt><code>0</code> (default)</dt>
479     <dd>No debug information is generated.</dd>
480
481     <dt><code>1</code></dt>
482     <dd><code class="module"><a href="../mod/mod_filter.html">mod_filter</a></code> will record buckets and brigades
483     passing through the filter to the error log, before the provider has
484     processed them. This is similar to the information generated by
485     <a href="http://apache.webthing.com/mod_diagnostics/">mod_diagnostics</a>.
486     </dd>
487
488     <dt><code>2</code> (not yet implemented)</dt>
489     <dd>Will dump the full data passing through to a tempfile before the
490     provider. <strong>For single-user debug only</strong>; this will not
491     support concurrent hits.</dd>
492     </dl>
493
494 </div>
495 </div>
496 <div class="bottomlang">
497 <p><span>Available Languages: </span><a href="../en/mod/mod_filter.html" title="English">&nbsp;en&nbsp;</a></p>
498 </div><div class="top"><a href="#page-header"><img src="../images/up.gif" alt="top" /></a></div><div class="section"><h2><a id="comments_section" name="comments_section">Comments</a></h2><div class="warning"><strong>Notice:</strong><br />This is not a Q&amp;A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Freenode, or sent to our <a href="http://httpd.apache.org/lists.html">mailing lists</a>.</div>
499 <script type="text/javascript"><!--//--><![CDATA[//><!--
500 var comments_shortname = 'httpd';
501 var comments_identifier = 'http://httpd.apache.org/docs/trunk/mod/mod_filter.html';
502 (function(w, d) {
503     if (w.location.hostname.toLowerCase() == "httpd.apache.org") {
504         d.write('<div id="comments_thread"><\/div>');
505         var s = d.createElement('script');
506         s.type = 'text/javascript';
507         s.async = true;
508         s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier;
509         (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s);
510     }
511     else {
512         d.write('<div id="comments_thread">Comments are disabled for this page at the moment.<\/div>');
513     }
514 })(window, document);
515 //--><!]]></script></div><div id="footer">
516 <p class="apache">Copyright 2016 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>
517 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/quickreference.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p></div><script type="text/javascript"><!--//--><![CDATA[//><!--
518 if (typeof(prettyPrint) !== 'undefined') {
519     prettyPrint();
520 }
521 //--><!]]></script>
522 </body></html>