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
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">
15 <link href="../images/favicon.ico" rel="shortcut icon" /></head>
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="<-" alt="<-" src="../images/left.gif" /></a></div>
23 <a href="http://www.apache.org/">Apache</a> > <a href="http://httpd.apache.org/">HTTP Server</a> > <a href="http://httpd.apache.org/docs/">Documentation</a> > <a href="../">Version 2.5</a> > <a href="./">Modules</a></div>
24 <div id="page-content">
25 <div id="preamble"><h1>Apache Module mod_policy</h1>
27 <p><span>Available Languages: </span><a href="../en/mod/mod_policy.html" title="English"> en </a></p>
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>
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>
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>
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>
55 <div id="quickview"><h3 class="directives">Directives</h3>
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>
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>
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>
90 <h2><a name="actions" id="actions">Actions</a></h2>
93 <p>If a policy is violated, one of the following actions can be
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>
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
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>
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>
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
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>
132 <p>The following policy filters are available:</p>
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>
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>
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
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
167 <dt><strong><a href="../compliance.html#policyvalidation">
168 POLICY_VALIDATION</a></strong>: Enforce the presence of Etag and/or
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>
175 <dt><strong><a href="../compliance.html#policyconditional">
176 POLICY_CONDITIONAL</a></strong>: Enforce correct operation of conditional
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
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>
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>
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>
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>
228 <p>A typical configuration protecting a server serving static content
229 might be as follows:</p>
231 <pre class="prettyprint lang-config">
233 SetOutputFilter POLICY_TYPE;POLICY_LENGTH;POLICY_KEEPALIVE;POLICY_VARY;POLICY_VALIDATION; \
234 POLICY_CONDITIONAL;POLICY_NOCACHE;POLICY_MAXAGE;POLICY_VERSION
236 # content type must be present and valid, but can be anything
237 PolicyType enforce */*
239 # reject if no explicitly declared content length
242 # covered by the policy length filter
243 PolicyKeepalive ignore
245 # reject if User-Agent appears within Vary headers
246 PolicyVary enforce User-Agent
248 # we want to enforce validation
249 PolicyValidation enforce
251 # non-functional conditional responses should be rejected
252 PolicyConditional enforce
254 # no-cache responses should be rejected
255 PolicyNocache enforce
257 # maxage must be at least a day
258 PolicyMaxage enforce 86400
260 # request version can be anything
261 PolicyVersion ignore HTTP/1.1
264 # suppress policy protection for server-status
265 <Location /server-status>
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
284 <p>When logged or enforced, a response that should have been conditional
285 but wasn't will be rejected.</p>
287 <div class="example"><h3>Example</h3><pre class="prettyprint lang-config">
288 # non-functional conditional responses should be rejected
289 PolicyConditional enforce
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
306 <p>Specify the URL of the documentation describing the conditional
307 request policy, to appear within error messages.</p>
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
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
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
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
347 <p>Master switch to enable or disable policies for a given URL space.</p>
349 <div class="example"><h3>Example</h3><pre class="prettyprint lang-config">
355 # suppress policy protection for server-status
356 <Location /server-status>
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
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>
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
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
398 <p>Specify the URL of the documentation describing the keepalive
399 policy, to appear within error messages.</p>
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
414 <p>When logged or enforced, a response that lacks an explicit
415 <code>Content-Length</code> header will be rejected.</p>
417 <div class="example"><h3>Example</h3><pre class="prettyprint lang-config">
418 # missing Content-Length header should be rejected
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
436 <p>Specify the URL of the documentation describing the content length
437 policy, to appear within error messages.</p>
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
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>
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
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
477 <p>Specify the URL of the documentation describing the caching minimum
478 freshness lifetime policy, to appear within error messages.</p>
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
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
497 <div class="example"><h3>Example</h3><pre class="prettyprint lang-config">
498 # Cache-Control: no-cache will be rejected
499 PolicyNocache enforce
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
517 <p>Specify the URL of the documentation describing the caching no-cache
518 policy, to appear within error messages.</p>
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
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>
537 <div class="example"><h3>Example</h3><pre class="prettyprint lang-config">
538 # enforce json or XML
539 PolicyType enforce application/json text/xml
543 <div class="example"><h3>Example</h3><pre class="prettyprint lang-config">
544 # malformed content type should be rejected
545 PolicyType enforce */*
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
563 <p>Specify the URL of the documentation describing the content type
564 policy, to appear within error messages.</p>
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
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>
583 <div class="example"><h3>Example</h3><pre class="prettyprint lang-config">
584 # no ETag or Last-Modified will be rejected
585 PolicyValidation enforce
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
603 <p>Specify the URL of the documentation describing the validation policy, to
604 appear within error messages.</p>
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
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
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
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
643 <p>Specify the URL of the documentation describing the vary policy, to
644 appear within error messages.</p>
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
659 <p>When logged or enforced, a request with a version lower than specified
660 will be rejected.</p>
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
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
682 <p>Specify the URL of the documentation describing the minimum request
683 HTTP version policy, to appear within error messages.</p>
687 <div class="bottomlang">
688 <p><span>Available Languages: </span><a href="../en/mod/mod_policy.html" title="English"> en </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>Notice:</strong><br />This is not a Q&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>
690 <script type="text/javascript"><!--//--><![CDATA[//><!--
691 var comments_shortname = 'httpd';
692 var comments_identifier = 'http://httpd.apache.org/docs/trunk/mod/mod_policy.html';
694 if (w.location.hostname.toLowerCase() == "httpd.apache.org") {
695 d.write('<div id="comments_thread"><\/div>');
696 var s = d.createElement('script');
697 s.type = 'text/javascript';
699 s.src = 'https://c.apaste.info/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier;
700 (d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s);
703 d.write('<div id="comments_thread">Comments are disabled for this page at the moment.<\/div>');
705 })(window, document);
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') {