]> granicus.if.org Git - apache/blob - docs/manual/mod/mod_policy.html.en
xforms
[apache] / docs / manual / mod / mod_policy.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         XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
5               This file is generated from xml source: DO NOT EDIT
6         XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
7       -->
8 <title>mod_policy - 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" /><link rel="stylesheet" type="text/css" href="../style/css/prettify.css" />
12 <script src="../style/scripts/prettify.js" type="text/javascript">
13 </script>
14
15 <link href="../images/favicon.ico" rel="shortcut icon" /></head>
16 <body>
17 <div id="page-header">
18 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.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>
19 <p class="apache">Apache HTTP Server Version 2.5</p>
20 <img alt="" src="../images/feather.gif" /></div>
21 <div class="up"><a href="./"><img title="&lt;-" alt="&lt;-" src="../images/left.gif" /></a></div>
22 <div id="path">
23 <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>
24 <div id="page-content">
25 <div id="preamble"><h1>Apache Module mod_policy</h1>
26 <div class="toplang">
27 <p><span>Available Languages: </span><a href="../en/mod/mod_policy.html" title="English">&nbsp;en&nbsp;</a></p>
28 </div>
29 <table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>HTTP protocol compliance enforcement.</td></tr>
30 <tr><th><a href="module-dict.html#Status">Status:</a></th><td>Extension</td></tr>
31 <tr><th><a href="module-dict.html#ModuleIdentifier">Module Identifier:</a></th><td>policy_module</td></tr>
32 <tr><th><a href="module-dict.html#SourceFile">Source File:</a></th><td>mod_policy.c</td></tr></table>
33 <h3>Summary</h3>
34
35     <p>The HTTP protocol recommends that clients should be "liberal in
36     what they accept", and servers "strict with what they send". In some
37     cases it can be difficult to detect when a server or an application
38     has been misconfigured, is serving uncacheable content or is behaving
39     suboptimally, as an HTTP client might be compensating for the server.
40     These problems can potentially lead to excessive bandwidth
41     consumption, or a server outage under load.</p>
42
43     <p>The <code class="module"><a href="../mod/mod_policy.html">mod_policy</a></code> module consists of a set of
44     filters that test servers for HTTP protocol compliance. These
45     tests allow the server administrator to log violations of, or
46     outright reject responses where certain defined conditions exist.</p>
47
48     <p>This could be used as a way to set minimum HTTP protocol compliance
49     criteria for a restful application. Alternatively, a reverse proxy or
50     cache could be configured to protect itself from misconfigured origin
51     servers or unexpectedly uncacheable content, or as a mechanism to
52     detect configuration mistakes within the server itself.</p>
53
54 </div>
55 <div id="quickview"><h3 class="directives">Directives</h3>
56 <ul id="toc">
57 <li><img alt="" src="../images/down.gif" /> <a href="#policyconditional">PolicyConditional</a></li>
58 <li><img alt="" src="../images/down.gif" /> <a href="#policyconditionalurl">PolicyConditionalURL</a></li>
59 <li><img alt="" src="../images/down.gif" /> <a href="#policyenvironment">PolicyEnvironment</a></li>
60 <li><img alt="" src="../images/down.gif" /> <a href="#policyfilter">PolicyFilter</a></li>
61 <li><img alt="" src="../images/down.gif" /> <a href="#policykeepalive">PolicyKeepalive</a></li>
62 <li><img alt="" src="../images/down.gif" /> <a href="#policykeepaliveurl">PolicyKeepaliveURL</a></li>
63 <li><img alt="" src="../images/down.gif" /> <a href="#policylength">PolicyLength</a></li>
64 <li><img alt="" src="../images/down.gif" /> <a href="#policylengthurl">PolicyLengthURL</a></li>
65 <li><img alt="" src="../images/down.gif" /> <a href="#policymaxage">PolicyMaxage</a></li>
66 <li><img alt="" src="../images/down.gif" /> <a href="#policymaxageurl">PolicyMaxageURL</a></li>
67 <li><img alt="" src="../images/down.gif" /> <a href="#policynocache">PolicyNocache</a></li>
68 <li><img alt="" src="../images/down.gif" /> <a href="#policynocacheurl">PolicyNocacheURL</a></li>
69 <li><img alt="" src="../images/down.gif" /> <a href="#policytype">PolicyType</a></li>
70 <li><img alt="" src="../images/down.gif" /> <a href="#policytypeurl">PolicyTypeURL</a></li>
71 <li><img alt="" src="../images/down.gif" /> <a href="#policyvalidation">PolicyValidation</a></li>
72 <li><img alt="" src="../images/down.gif" /> <a href="#policyvalidationurl">PolicyValidationURL</a></li>
73 <li><img alt="" src="../images/down.gif" /> <a href="#policyvary">PolicyVary</a></li>
74 <li><img alt="" src="../images/down.gif" /> <a href="#policyvaryurl">PolicyVaryURL</a></li>
75 <li><img alt="" src="../images/down.gif" /> <a href="#policyversion">PolicyVersion</a></li>
76 <li><img alt="" src="../images/down.gif" /> <a href="#policyversionurl">PolicyVersionURL</a></li>
77 </ul>
78 <h3>Topics</h3>
79 <ul id="topics">
80 <li><img alt="" src="../images/down.gif" /> <a href="#actions">Actions</a></li>
81 <li><img alt="" src="../images/down.gif" /> <a href="#tests">Policy Tests</a></li>
82 <li><img alt="" src="../images/down.gif" /> <a href="#example">Example Configuration</a></li>
83 </ul><h3>See also</h3>
84 <ul class="seealso">
85 <li><a href="../filter.html">Filters</a></li>
86 <li><a href="../compliance.html">HTTP Protocol Compliance</a></li>
87 </ul><ul class="seealso"><li><a href="#comments_section">Comments</a></li></ul></div>
88 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
89 <div class="section">
90 <h2><a name="actions" id="actions">Actions</a></h2>
91     
92
93     <p>If a policy is violated, one of the following actions can be
94     taken:</p>
95
96     <dl>
97     <dt><strong>ignore</strong></dt>
98     <dd>The policy check will be ignored for the given URL space, even
99     if the filter is present.</dd>
100
101     <dt><strong>log</strong></dt>
102     <dd>The policy check will be executed, and if a violation is detected
103     a warning will be logged to the server error_log, and a
104     <code>Warning</code> header added to the response for the benefit of
105     the client.</dd>
106
107     <dt><strong>enforce</strong></dt>
108     <dd>The policy check will be executed, and if a violation is detected
109     an error will be logged to the server error_log, a
110     <code>Warning</code> header added to the response, and a <code>502
111     Bad Gateway</code> will be returned to the client. Optional links to
112     explanatory documentation can be added to each error message,
113     detailing the origin of each policy.</dd>
114
115     </dl>
116
117     <p>It is also possible to selectively disable all policies for a
118     given URL space, should the need arise, using the
119     <code class="directive"><a href="#policyfilter">PolicyFilter</a></code> directive.</p>
120
121     <p>Alternatively, the
122     <code class="directive"><a href="#policyenvironment">PolicyEnvironment</a></code>
123     directive can be used to specify an environment variable, which if
124     present, will cause the policies to be selectively downgraded or
125     bypassed.</p>
126
127 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
128 <div class="section">
129 <h2><a name="tests" id="tests">Policy Tests</a></h2>
130     
131
132     <p>The following policy filters are available:</p>
133
134     <dl>
135     <dt><strong><a href="../compliance.html#policytype">POLICY_TYPE</a>
136     </strong>: Enforce valid content types</dt>
137     <dd>Content types that are syntactically invalid or blank can be detected
138         and the request rejected. Types can be restricted to a specific list
139         containing optional wildcards ? and *.</dd>
140     
141     <dt><strong><a href="../compliance.html#policylength">POLICY_LENGTH</a>
142     </strong>: Enforce the presence of a Content-Length</dt>
143     <dd>The length of responses can be specified in one of three ways, by
144     specifying an explicit length in advance, using chunked encoding to set
145     the length, or by setting no length at all and terminating the request
146     when complete. The absence of a specific content length can affect the
147     cacheability of the response, and prevents the use of keepalive during
148     HTTP/1.0 requests. This policy enforces the presence of an explicit
149     content length on the response.</dd>
150
151     <dt><strong><a href="../compliance.html#policykeepalive">POLICY_KEEPALIVE
152     </a></strong>: Enforce the option to keepalive</dt>
153     <dd>Less restrictive than the POLICY_LENGTH test, this policy enforces the
154     possibility that the response can be kept alive. If the response doesn't
155     have a protocol defined zero length, and the response isn't already an
156     error, and the response has neither a Content-Length or is declared
157     HTTP/1.1 and lacks Content-Encoding: chunked, then this response will be
158     rejected.</dd>
159
160     <dt><strong><a href="../compliance.html#policyvary">POLICY_VARY</a>
161     </strong>: Enforce the absence of certain headers within Vary headers</dt>
162     <dd>If the Vary header contains any of the headers specified, this policy
163     will reject the request. The typical case is the presence of the User-Agent
164     within Vary, which is likely to cause a denial of service condition to a
165     cache.</dd>
166
167     <dt><strong><a href="../compliance.html#policyvalidation">
168     POLICY_VALIDATION</a></strong>: Enforce the presence of Etag and/or
169     Last-Modified</dt>
170     <dd>The ability for a cache to determine whether a cached entity can be
171     refreshed is dependent on whether a valid Etag and/or Last-Modified header
172     is present to revalidate against. The absence of both headers, or the
173     invalid syntax of a header will cause this policy to be rejected.</dd>
174
175     <dt><strong><a href="../compliance.html#policyconditional">
176     POLICY_CONDITIONAL</a></strong>: Enforce correct operation of conditional
177     requests</dt>
178     <dd>When conditional headers are present in the request, a server should
179     respond with a <code>304 Not Modified</code> or <code>412 Precondition
180     Failed</code> response where appropriate. A server may ignore conditional
181     headers, and this affects the efficiency of the HTTP caching mechanism.
182     This policy rejects requests where a conditional header is present, and
183     a 304 or 412 response code was expected, but a 2xx response was seen
184     instead.</dd>
185
186     <dt><strong><a href="../compliance.html#policynocache">POLICY_NOCACHE</a>
187     </strong>: Enforce cacheable responses</dt>
188     <dd>When a response is encountered that declares itself explicitly
189     uncacheable, the request is rejected. A response is considered
190     uncacheable if it specifies any of the following:
191     <ul><li><code>Cache-Control: no-cache</code></li>
192     <li><code>Pragma: no-cache</code></li>
193     <li><code>Cache-Control: no-store</code></li>
194     <li><code>Cache-Control: private</code></li>
195     </ul></dd>
196
197     <dt><strong><a href="../compliance.html#policymaxage">POLICY_MAXAGE</a>
198     </strong>: Enforce a minimum maxage</dt>
199     <dd>When a response is encountered where the freshness lifetime is less
200     than the given value, or the freshness lifetime is heuristic, the request
201     is rejected. A response is checked in the following order:
202     <ul><li>If <code>s-maxage</code> is present but too small; or</li>
203     <li>If <code>max-age</code> is present but too small; or</li>
204     <li>If <code>Expires</code> is present and invalid; or</li>
205     <li><code>Date</code> is present and invalid; or</li>
206     <li><code>Expires</code> minus Date is too small; or</li>
207     <li>No <code>s-maxage</code>, <code>maxage</code>, or
208     <code>Expires</code>/<code>Date</code> declared at all</li>
209     </ul></dd>
210
211     <dt><strong><a href="../compliance.html#policyversion">POLICY_VERSION</a>
212     </strong>: Enforce a minimum HTTP version within a request</dt>
213     <dd>When a request is encountered with an HTTP version number less than
214     the required minimum version, the request is rejected. The following
215     version numbers are recognised:
216     <ul><li><code>HTTP/1.1</code></li>
217     <li><code>HTTP/1.0</code></li>
218     <li><code>HTTP/0.9</code></li>
219     </ul></dd>
220
221     </dl>
222
223 </div><div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
224 <div class="section">
225 <h2><a name="example" id="example">Example Configuration</a></h2>
226     
227
228     <p>A typical configuration protecting a server serving static content
229     might be as follows:</p>
230
231     <pre class="prettyprint lang-config">
232 &lt;Location /&gt;
233   SetOutputFilter POLICY_TYPE;POLICY_LENGTH;POLICY_KEEPALIVE;POLICY_VARY;POLICY_VALIDATION; \
234     POLICY_CONDITIONAL;POLICY_NOCACHE;POLICY_MAXAGE;POLICY_VERSION
235   
236   # content type must be present and valid, but can be anything
237   PolicyType enforce */*
238   
239   # reject if no explicitly declared content length
240   PolicyLength enforce
241   
242   # covered by the policy length filter
243   PolicyKeepalive ignore
244   
245   # reject if User-Agent appears within Vary headers
246   PolicyVary enforce User-Agent
247   
248   # we want to enforce validation
249   PolicyValidation enforce
250   
251   # non-functional conditional responses should be rejected
252   PolicyConditional enforce
253   
254   # no-cache responses should be rejected
255   PolicyNocache enforce
256   
257   # maxage must be at least a day
258   PolicyMaxage enforce 86400
259   
260   # request version can be anything
261   PolicyVersion ignore HTTP/1.1
262 &lt;/Location&gt;
263
264 # suppress policy protection for server-status
265 &lt;Location /server-status&gt;
266   PolicyFilter off
267 &lt;/Location&gt;
268     </pre>
269
270
271 </div>
272 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
273 <div class="directive-section"><h2><a name="PolicyConditional" id="PolicyConditional">PolicyConditional</a> <a name="policyconditional" id="policyconditional">Directive</a></h2>
274 <table class="directive">
275 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enable the conditional request policy.</td></tr>
276 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>PolicyConditional <var>ignore|log|enforce</var></code></td></tr>
277 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ignore</code></td></tr>
278 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
279 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
280 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_policy</td></tr>
281 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>PolicyConditional is only available in Apache 2.5.0 and
282 later.</td></tr>
283 </table>
284     <p>When logged or enforced, a response that should have been conditional
285     but wasn't will be rejected.</p>
286
287     <div class="example"><h3>Example</h3><pre class="prettyprint lang-config">
288 # non-functional conditional responses should be rejected
289 PolicyConditional enforce
290     </pre>
291 </div>
292
293 </div>
294 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
295 <div class="directive-section"><h2><a name="PolicyConditionalURL" id="PolicyConditionalURL">PolicyConditionalURL</a> <a name="policyconditionalurl" id="policyconditionalurl">Directive</a></h2>
296 <table class="directive">
297 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>URL describing the conditional request policy.</td></tr>
298 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>PolicyConditionalURL <var>url</var></code></td></tr>
299 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>none</code></td></tr>
300 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
301 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
302 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_policy</td></tr>
303 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>PolicyConditionalURL is only available in Apache 2.5.0 and
304 later.</td></tr>
305 </table>
306     <p>Specify the URL of the documentation describing the conditional
307     request policy, to appear within error messages.</p>
308
309 </div>
310 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
311 <div class="directive-section"><h2><a name="PolicyEnvironment" id="PolicyEnvironment">PolicyEnvironment</a> <a name="policyenvironment" id="policyenvironment">Directive</a></h2>
312 <table class="directive">
313 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Override policies based on an environment variable.</td></tr>
314 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>PolicyEnvironment <var>variable</var> <var>log-value</var> <var>ignore-value</var></code></td></tr>
315 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>none</code></td></tr>
316 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
317 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
318 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_policy</td></tr>
319 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>PolicyEnvironment is only available in Apache 2.5.0 and
320 later.</td></tr>
321 </table>
322     <p>Downgrade policies to logging only or ignored based on the presence
323     of an environment variable. If the given variable is present and equal
324     to the log-value, enforced policies will be logged instead. If the given
325     variable is present and equal to the ignore-value, all policies will
326     be ignored.</p>
327
328     <div class="example"><h3>Example</h3><pre class="prettyprint lang-config">
329 # downgrade if POLICY_CONTROL was present
330 PolicyEnvironment POLICY_CONTROL log ignore
331     </pre>
332 </div>
333
334 </div>
335 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
336 <div class="directive-section"><h2><a name="PolicyFilter" id="PolicyFilter">PolicyFilter</a> <a name="policyfilter" id="policyfilter">Directive</a></h2>
337 <table class="directive">
338 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enable or disable policies for the given URL space.</td></tr>
339 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>PolicyFilter <var>on|off</var></code></td></tr>
340 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>on</code></td></tr>
341 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
342 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
343 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_policy</td></tr>
344 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>PolicyFilter is only available in Apache 2.5.0 and
345 later.</td></tr>
346 </table>
347     <p>Master switch to enable or disable policies for a given URL space.</p>
348
349     <div class="example"><h3>Example</h3><pre class="prettyprint lang-config">
350 # enabled by default
351 &lt;Location /&gt;
352   PolicyFilter on
353 &lt;/Location&gt;
354
355 # suppress policy protection for server-status
356 &lt;Location /server-status&gt;
357   PolicyFilter off
358 &lt;/Location&gt;
359 </pre>
360 </div>
361
362 </div>
363 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
364 <div class="directive-section"><h2><a name="PolicyKeepalive" id="PolicyKeepalive">PolicyKeepalive</a> <a name="policykeepalive" id="policykeepalive">Directive</a></h2>
365 <table class="directive">
366 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enable the keepalive policy.</td></tr>
367 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>PolicyKeepalive <var>ignore|log|enforce</var></code></td></tr>
368 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ignore</code></td></tr>
369 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
370 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
371 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_policy</td></tr>
372 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>PolicyKeepalive is only available in Apache 2.5.0 and
373 later.</td></tr>
374 </table>
375     <p>When logged or enforced, a response that lacks both an explicit
376     <code>Content-Length</code> header and a <code>Transfer-Encoding</code>
377     of <code>chunked</code> will be rejected.</p>
378
379     <div class="example"><h3>Example</h3><pre class="prettyprint lang-config">
380 # missing Content-Length or Transfer-Encoding should be rejected
381 PolicyKeepalive enforce
382 </pre>
383 </div>
384
385 </div>
386 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
387 <div class="directive-section"><h2><a name="PolicyKeepaliveURL" id="PolicyKeepaliveURL">PolicyKeepaliveURL</a> <a name="policykeepaliveurl" id="policykeepaliveurl">Directive</a></h2>
388 <table class="directive">
389 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>URL describing the keepalive policy.</td></tr>
390 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>PolicyKeepaliveURL <var>url</var></code></td></tr>
391 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>none</code></td></tr>
392 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
393 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
394 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_policy</td></tr>
395 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>PolicyKeepaliveURL is only available in Apache 2.5.0 and
396 later.</td></tr>
397 </table>
398     <p>Specify the URL of the documentation describing the keepalive
399     policy, to appear within error messages.</p>
400
401 </div>
402 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
403 <div class="directive-section"><h2><a name="PolicyLength" id="PolicyLength">PolicyLength</a> <a name="policylength" id="policylength">Directive</a></h2>
404 <table class="directive">
405 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enable the content length policy.</td></tr>
406 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>PolicyLength <var>ignore|log|enforce</var></code></td></tr>
407 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ignore</code></td></tr>
408 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
409 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
410 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_policy</td></tr>
411 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>PolicyLength is only available in Apache 2.5.0 and
412 later.</td></tr>
413 </table>
414     <p>When logged or enforced, a response that lacks an explicit
415     <code>Content-Length</code> header will be rejected.</p>
416
417     <div class="example"><h3>Example</h3><pre class="prettyprint lang-config">
418 # missing Content-Length header should be rejected
419 PolicyLength enforce
420     </pre>
421 </div>
422
423 </div>
424 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
425 <div class="directive-section"><h2><a name="PolicyLengthURL" id="PolicyLengthURL">PolicyLengthURL</a> <a name="policylengthurl" id="policylengthurl">Directive</a></h2>
426 <table class="directive">
427 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>URL describing the content length policy.</td></tr>
428 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>PolicyLengthURL <var>url</var></code></td></tr>
429 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>none</code></td></tr>
430 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
431 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
432 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_policy</td></tr>
433 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>PolicyLengthURL is only available in Apache 2.5.0 and
434 later.</td></tr>
435 </table>
436     <p>Specify the URL of the documentation describing the content length
437     policy, to appear within error messages.</p>
438
439 </div>
440 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
441 <div class="directive-section"><h2><a name="PolicyMaxage" id="PolicyMaxage">PolicyMaxage</a> <a name="policymaxage" id="policymaxage">Directive</a></h2>
442 <table class="directive">
443 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enable the caching minimum max-age policy.</td></tr>
444 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>PolicyMaxage <var>ignore|log|enforce</var> <var>age</var></code></td></tr>
445 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ignore</code></td></tr>
446 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
447 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
448 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_policy</td></tr>
449 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>PolicyMaxage is only available in Apache 2.5.0 and
450 later.</td></tr>
451 </table>
452     <p>When logged or enforced, a response that lacks an explicit freshness
453     lifetime defined with <code>max-age</code>, <code>s-maxage</code> or an
454     <code>Expires</code> header, or where the explicit freshness lifetime is
455     smaller than the given value, will be rejected.</p>
456
457     <div class="example"><h3>Example</h3><pre class="prettyprint lang-config">
458 # reject responses with a freshness lifetime shorter than a day
459 PolicyMaxage enforce 86400
460     </pre>
461 </div>
462
463
464 </div>
465 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
466 <div class="directive-section"><h2><a name="PolicyMaxageURL" id="PolicyMaxageURL">PolicyMaxageURL</a> <a name="policymaxageurl" id="policymaxageurl">Directive</a></h2>
467 <table class="directive">
468 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>URL describing the caching minimum freshness lifetime policy.</td></tr>
469 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>PolicyMaxageURL <var>url</var></code></td></tr>
470 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>none</code></td></tr>
471 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
472 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
473 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_policy</td></tr>
474 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>PolicyMaxageURL is only available in Apache 2.5.0 and
475 later.</td></tr>
476 </table>
477     <p>Specify the URL of the documentation describing the caching minimum
478     freshness lifetime policy, to appear within error messages.</p>
479
480 </div>
481 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
482 <div class="directive-section"><h2><a name="PolicyNocache" id="PolicyNocache">PolicyNocache</a> <a name="policynocache" id="policynocache">Directive</a></h2>
483 <table class="directive">
484 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enable the caching no-cache policy.</td></tr>
485 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>PolicyNocache <var>ignore|log|enforce</var></code></td></tr>
486 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ignore</code></td></tr>
487 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
488 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
489 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_policy</td></tr>
490 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>PolicyNocache is only available in Apache 2.5.0 and
491 later.</td></tr>
492 </table>
493     <p>When logged or enforced, a response that defines itself uncacheable
494     using the <code>Cache-Control</code> or <code>Pragma</code> headers will
495     be rejected.</p>
496
497     <div class="example"><h3>Example</h3><pre class="prettyprint lang-config">
498 # Cache-Control: no-cache will be rejected
499 PolicyNocache enforce
500     </pre>
501 </div>
502
503
504 </div>
505 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
506 <div class="directive-section"><h2><a name="PolicyNocacheURL" id="PolicyNocacheURL">PolicyNocacheURL</a> <a name="policynocacheurl" id="policynocacheurl">Directive</a></h2>
507 <table class="directive">
508 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>URL describing the caching no-cache policy.</td></tr>
509 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>PolicyNocacheURL <var>url</var></code></td></tr>
510 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>none</code></td></tr>
511 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
512 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
513 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_policy</td></tr>
514 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>PolicyNocacheURL is only available in Apache 2.5.0 and
515 later.</td></tr>
516 </table>
517     <p>Specify the URL of the documentation describing the caching no-cache
518     policy, to appear within error messages.</p>
519
520 </div>
521 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
522 <div class="directive-section"><h2><a name="PolicyType" id="PolicyType">PolicyType</a> <a name="policytype" id="policytype">Directive</a></h2>
523 <table class="directive">
524 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enable the content type policy.</td></tr>
525 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>PolicyType <var>ignore|log|enforce</var> <var>type</var> [ <var>type</var> [ ... ]]</code></td></tr>
526 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ignore</code></td></tr>
527 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
528 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
529 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_policy</td></tr>
530 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>PolicyType is only available in Apache 2.5.0 and
531 later.</td></tr>
532 </table>
533     <p>When logged or enforced, a response that lacks a <code>Content-Type</code>
534     header, where the <code>Content-Type</code> header is malformed, or where the
535     header does not match the given pattern or patterns will be rejected.</p>
536
537     <div class="example"><h3>Example</h3><pre class="prettyprint lang-config">
538 # enforce json or XML
539 PolicyType enforce application/json text/xml
540     </pre>
541 </div>
542
543     <div class="example"><h3>Example</h3><pre class="prettyprint lang-config">
544 # malformed content type should be rejected
545 PolicyType enforce */*
546     </pre>
547 </div>
548
549
550 </div>
551 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
552 <div class="directive-section"><h2><a name="PolicyTypeURL" id="PolicyTypeURL">PolicyTypeURL</a> <a name="policytypeurl" id="policytypeurl">Directive</a></h2>
553 <table class="directive">
554 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>URL describing the content type policy.</td></tr>
555 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>PolicyTypeURL <var>url</var></code></td></tr>
556 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>none</code></td></tr>
557 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
558 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
559 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_policy</td></tr>
560 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>PolicyTypeURL is only available in Apache 2.5.0 and
561 later.</td></tr>
562 </table>
563     <p>Specify the URL of the documentation describing the content type
564     policy, to appear within error messages.</p>
565
566 </div>
567 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
568 <div class="directive-section"><h2><a name="PolicyValidation" id="PolicyValidation">PolicyValidation</a> <a name="policyvalidation" id="policyvalidation">Directive</a></h2>
569 <table class="directive">
570 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enable the validation policy.</td></tr>
571 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>PolicyValidation <var>ignore|log|enforce</var></code></td></tr>
572 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ignore</code></td></tr>
573 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
574 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
575 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_policy</td></tr>
576 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>PolicyValidation is only available in Apache 2.5.0 and
577 later.</td></tr>
578 </table>
579     <p>When logged or enforced, a response that lacks either a valid
580     <code>ETag</code> header or a <code>Last-Modified</code> header, or where
581     either header is syntactically incorrect, will be rejected.</p>
582
583     <div class="example"><h3>Example</h3><pre class="prettyprint lang-config">
584 # no ETag or Last-Modified will be rejected
585 PolicyValidation enforce
586     </pre>
587 </div>
588
589
590 </div>
591 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
592 <div class="directive-section"><h2><a name="PolicyValidationURL" id="PolicyValidationURL">PolicyValidationURL</a> <a name="policyvalidationurl" id="policyvalidationurl">Directive</a></h2>
593 <table class="directive">
594 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>URL describing the content type policy.</td></tr>
595 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>PolicyValidationURL <var>url</var></code></td></tr>
596 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>none</code></td></tr>
597 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
598 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
599 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_policy</td></tr>
600 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>PolicyValidationURL is only available in Apache 2.5.0 and
601 later.</td></tr>
602 </table>
603     <p>Specify the URL of the documentation describing the validation policy, to
604     appear within error messages.</p>
605
606 </div>
607 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
608 <div class="directive-section"><h2><a name="PolicyVary" id="PolicyVary">PolicyVary</a> <a name="policyvary" id="policyvary">Directive</a></h2>
609 <table class="directive">
610 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enable the Vary policy.</td></tr>
611 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>PolicyVary <var>ignore|log|enforce</var> <var>header</var> [ <var>header</var> [ ... ]]</code></td></tr>
612 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ignore</code></td></tr>
613 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
614 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
615 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_policy</td></tr>
616 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>PolicyVary is only available in Apache 2.5.0 and
617 later.</td></tr>
618 </table>
619     <p>When logged or enforced, a response that contains a <code>Vary</code>
620     header which in turn contains one of the headers listed, will be
621     rejected.</p>
622
623     <div class="example"><h3>Example</h3><pre class="prettyprint lang-config">
624 # reject reponses with "User-Agent" listed in the Vary header
625 PolicyVary enforce User-Agent
626     </pre>
627 </div>
628
629
630 </div>
631 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
632 <div class="directive-section"><h2><a name="PolicyVaryURL" id="PolicyVaryURL">PolicyVaryURL</a> <a name="policyvaryurl" id="policyvaryurl">Directive</a></h2>
633 <table class="directive">
634 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>URL describing the content type policy.</td></tr>
635 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>PolicyVaryURL <var>url</var></code></td></tr>
636 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>none</code></td></tr>
637 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
638 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
639 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_policy</td></tr>
640 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>PolicyVaryURL is only available in Apache 2.5.0 and
641 later.</td></tr>
642 </table>
643     <p>Specify the URL of the documentation describing the vary policy, to
644     appear within error messages.</p>
645
646 </div>
647 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
648 <div class="directive-section"><h2><a name="PolicyVersion" id="PolicyVersion">PolicyVersion</a> <a name="policyversion" id="policyversion">Directive</a></h2>
649 <table class="directive">
650 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Enable the version policy.</td></tr>
651 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>PolicyVersion <var>ignore|log|enforce</var> <var>HTTP/0.9|HTTP/1.0|HTTP/1.1</var></code></td></tr>
652 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>ignore</code></td></tr>
653 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
654 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
655 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_policy</td></tr>
656 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>PolicyVersion is only available in Apache 2.5.0 and
657 later.</td></tr>
658 </table>
659     <p>When logged or enforced, a request with a version lower than specified
660     will be rejected.</p>
661
662     <div class="example"><h3>Example</h3><pre class="prettyprint lang-config">
663 # reject requests with an HTTP version older than HTTP/1.1
664 PolicyVersion enforce HTTP/1.1
665     </pre>
666 </div>
667
668
669 </div>
670 <div class="top"><a href="#page-header"><img alt="top" src="../images/up.gif" /></a></div>
671 <div class="directive-section"><h2><a name="PolicyVersionURL" id="PolicyVersionURL">PolicyVersionURL</a> <a name="policyversionurl" id="policyversionurl">Directive</a></h2>
672 <table class="directive">
673 <tr><th><a href="directive-dict.html#Description">Description:</a></th><td>URL describing the minimum request HTTP version policy.</td></tr>
674 <tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>PolicyVersionURL <var>url</var></code></td></tr>
675 <tr><th><a href="directive-dict.html#Default">Default:</a></th><td><code>none</code></td></tr>
676 <tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory</td></tr>
677 <tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
678 <tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_policy</td></tr>
679 <tr><th><a href="directive-dict.html#Compatibility">Compatibility:</a></th><td>PolicyVersionURL is only available in Apache 2.5.0 and
680 later.</td></tr>
681 </table>
682     <p>Specify the URL of the documentation describing the minimum request
683     HTTP version policy, to appear within error messages.</p>
684
685 </div>
686 </div>
687 <div class="bottomlang">
688 <p><span>Available Languages: </span><a href="../en/mod/mod_policy.html" title="English">&nbsp;en&nbsp;</a></p>
689 </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>This section is experimental!</strong><br />Comments placed here should not be expected 
690 to last beyond the testing phase of this system, nor do we in any way guarantee that we'll read them.</div>
691 <div id="disqus_thread">
692 </div><script type="text/javascript"><!--//--><![CDATA[//><!--
693 var lang = 'en';
694 var disqus_shortname = 'httpd';
695 var disqus_identifier = window.location.href.replace(/(current|trunk)/, "2.4").replace(/\/[a-z]{2}\//, "/").replace(window.location.protocol, "http:") + '.' + lang;
696 if (disqus_identifier.indexOf("httpd.apache.org") != -1) {
697     (function() {
698                 var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
699                 dsq.src = window.location.protocol + '//' + disqus_shortname + '.disqus.com/embed.js';
700             (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
701         })();
702 } else {
703     var text = document.createTextNode("Comments have been disabled for offline viewing.");
704     document.getElementById('disqus_thread').appendChild(text);
705 }
706 //--><!]]></script></div><div id="footer">
707 <p class="apache">Copyright 2012 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>
708 <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.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[//><!--
709 if (typeof(prettyPrint) !== undefined) {
710     prettyPrint();
711 }
712 //--><!]]></script>
713 </body></html>