mod_cache.xml revision 0e7b9978df6fac23db4330b09e890cf6de6ff7b6
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard<?xml version="1.0"?>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard<!DOCTYPE modulesynopsis SYSTEM "/style/modulesynopsis.dtd">
e942c741056732f50da2074b36fe59805d370650slive<?xml-stylesheet type="text/xsl" href="/style/manual.en.xsl"?>
5f5d1b4cc970b7f06ff8ef6526128e9a27303d88nd<!-- $LastChangedRevision$ -->
d5d794fc2f4cc9ca6d6da17cfa2cdcd8d244bacdnd
d5d794fc2f4cc9ca6d6da17cfa2cdcd8d244bacdnd<!--
db479b48bd4d75423ed4a45e15b75089d1a8ad72fielding Licensed to the Apache Software Foundation (ASF) under one or more
db479b48bd4d75423ed4a45e15b75089d1a8ad72fielding contributor license agreements. See the NOTICE file distributed with
db479b48bd4d75423ed4a45e15b75089d1a8ad72fielding this work for additional information regarding copyright ownership.
db479b48bd4d75423ed4a45e15b75089d1a8ad72fielding The ASF licenses this file to You under the Apache License, Version 2.0
db479b48bd4d75423ed4a45e15b75089d1a8ad72fielding (the "License"); you may not use this file except in compliance with
db479b48bd4d75423ed4a45e15b75089d1a8ad72fielding the License. You may obtain a copy of the License at
d5d794fc2f4cc9ca6d6da17cfa2cdcd8d244bacdnd
d5d794fc2f4cc9ca6d6da17cfa2cdcd8d244bacdnd http://www.apache.org/licenses/LICENSE-2.0
d5d794fc2f4cc9ca6d6da17cfa2cdcd8d244bacdnd
d5d794fc2f4cc9ca6d6da17cfa2cdcd8d244bacdnd Unless required by applicable law or agreed to in writing, software
d5d794fc2f4cc9ca6d6da17cfa2cdcd8d244bacdnd distributed under the License is distributed on an "AS IS" BASIS,
d5d794fc2f4cc9ca6d6da17cfa2cdcd8d244bacdnd WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
d5d794fc2f4cc9ca6d6da17cfa2cdcd8d244bacdnd See the License for the specific language governing permissions and
d5d794fc2f4cc9ca6d6da17cfa2cdcd8d244bacdnd limitations under the License.
d5d794fc2f4cc9ca6d6da17cfa2cdcd8d244bacdnd-->
d5d794fc2f4cc9ca6d6da17cfa2cdcd8d244bacdnd
7db9f691a00ead175b03335457ca296a33ddf31bnd<modulesynopsis metafile="mod_cache.xml.meta">
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard<name>mod_cache</name>
f312a039cc79d35be2dcb8aa20d91b31b9394c9fminfrin<description>RFC 2616 compliant HTTP caching filter.</description>
2f2ba5fb35129a32c3add3a797fa47e28ce3224cnd<status>Extension</status>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard<sourcefile>mod_cache.c</sourcefile>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard<identifier>cache_module</identifier>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard<summary>
7b467aa53854c95318a1c709709c1619a4f47118minfrin <note type="warning">This module should be used with care, as when the
7b467aa53854c95318a1c709709c1619a4f47118minfrin <directive module="mod_cache">CacheQuickHandler</directive> directive is
860b4efe27e7c1c9a2bf5c872b29c90f76849b51jim in its default value of <strong>on</strong>, the <directive
860b4efe27e7c1c9a2bf5c872b29c90f76849b51jim module="mod_authz_host">Allow</directive> and <directive
7b467aa53854c95318a1c709709c1619a4f47118minfrin module="mod_authz_host">Deny</directive> directives will be circumvented.
7b467aa53854c95318a1c709709c1619a4f47118minfrin You should not enable quick handler caching for any content to which you
7b467aa53854c95318a1c709709c1619a4f47118minfrin wish to limit access by client host name, address or environment
860b4efe27e7c1c9a2bf5c872b29c90f76849b51jim variable.</note>
b77f6f03c0b6bbc6ecd6e87358f568024733d680colm
15f37a157fbbf107658ed82ec30c348a9b6e518end <p><module>mod_cache</module> implements an <a
f312a039cc79d35be2dcb8aa20d91b31b9394c9fminfrin href="http://www.ietf.org/rfc/rfc2616.txt">RFC 2616</a> compliant
f312a039cc79d35be2dcb8aa20d91b31b9394c9fminfrin <strong>HTTP content caching filter</strong>, with support for the caching
f312a039cc79d35be2dcb8aa20d91b31b9394c9fminfrin of content negotiated responses containing the Vary header.</p>
f312a039cc79d35be2dcb8aa20d91b31b9394c9fminfrin
f312a039cc79d35be2dcb8aa20d91b31b9394c9fminfrin <p>RFC 2616 compliant caching provides a mechanism to verify whether
f312a039cc79d35be2dcb8aa20d91b31b9394c9fminfrin stale or expired content is still fresh, and can represent a significant
f312a039cc79d35be2dcb8aa20d91b31b9394c9fminfrin performance boost when the origin server supports <strong>conditional
f312a039cc79d35be2dcb8aa20d91b31b9394c9fminfrin requests</strong> by honouring the
f312a039cc79d35be2dcb8aa20d91b31b9394c9fminfrin <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.26">If-None-Match</a>
f312a039cc79d35be2dcb8aa20d91b31b9394c9fminfrin HTTP request header. Content is only regenerated from scratch when the content
f312a039cc79d35be2dcb8aa20d91b31b9394c9fminfrin has changed, and not when the cached entry expires.</p>
f312a039cc79d35be2dcb8aa20d91b31b9394c9fminfrin
f312a039cc79d35be2dcb8aa20d91b31b9394c9fminfrin <p>As a filter, <module>mod_cache</module> can be placed in front of
f312a039cc79d35be2dcb8aa20d91b31b9394c9fminfrin content originating from any handler, including <strong>flat
f312a039cc79d35be2dcb8aa20d91b31b9394c9fminfrin files</strong> (served from a slow disk cached on a fast disk), the output
f312a039cc79d35be2dcb8aa20d91b31b9394c9fminfrin of a <strong>CGI script</strong> or <strong>dynamic content
f312a039cc79d35be2dcb8aa20d91b31b9394c9fminfrin generator</strong>, or content <strong>proxied from another
f312a039cc79d35be2dcb8aa20d91b31b9394c9fminfrin server</strong>.</p>
f312a039cc79d35be2dcb8aa20d91b31b9394c9fminfrin
f312a039cc79d35be2dcb8aa20d91b31b9394c9fminfrin <p>In the default configuration, <module>mod_cache</module> inserts the
f312a039cc79d35be2dcb8aa20d91b31b9394c9fminfrin caching filter as far forward as possible within the filter stack,
f312a039cc79d35be2dcb8aa20d91b31b9394c9fminfrin utilising the <strong>quick handler</strong> to bypass all per request
f312a039cc79d35be2dcb8aa20d91b31b9394c9fminfrin processing when returning content to the client. In this mode of
f312a039cc79d35be2dcb8aa20d91b31b9394c9fminfrin operation, <module>mod_cache</module> may be thought of as a caching
f312a039cc79d35be2dcb8aa20d91b31b9394c9fminfrin proxy server bolted to the front of the webserver, while running within
f312a039cc79d35be2dcb8aa20d91b31b9394c9fminfrin the webserver itself.</p>
f312a039cc79d35be2dcb8aa20d91b31b9394c9fminfrin
f312a039cc79d35be2dcb8aa20d91b31b9394c9fminfrin <p>When the quick handler is switched off using the
f312a039cc79d35be2dcb8aa20d91b31b9394c9fminfrin <directive module="mod_cache">CacheQuickHandler</directive> directive,
f312a039cc79d35be2dcb8aa20d91b31b9394c9fminfrin it becomes possible to insert the <strong>CACHE</strong> filter at a
f312a039cc79d35be2dcb8aa20d91b31b9394c9fminfrin point in the filter stack chosen by the administrator. This provides the
f312a039cc79d35be2dcb8aa20d91b31b9394c9fminfrin opportunity to cache content before that content is personalised by the
f312a039cc79d35be2dcb8aa20d91b31b9394c9fminfrin <module>mod_include</module> filter, or optionally compressed by the
f312a039cc79d35be2dcb8aa20d91b31b9394c9fminfrin <module>mod_deflate</module> filter.</p>
f312a039cc79d35be2dcb8aa20d91b31b9394c9fminfrin
f312a039cc79d35be2dcb8aa20d91b31b9394c9fminfrin <p>Under normal operation, <module>mod_cache</module> will respond to
f312a039cc79d35be2dcb8aa20d91b31b9394c9fminfrin and can be controlled by the
f312a039cc79d35be2dcb8aa20d91b31b9394c9fminfrin <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9">Cache-Control</a>
f312a039cc79d35be2dcb8aa20d91b31b9394c9fminfrin and
f312a039cc79d35be2dcb8aa20d91b31b9394c9fminfrin <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.32">Pragma</a>
f312a039cc79d35be2dcb8aa20d91b31b9394c9fminfrin headers sent from a client in a request, or from a
f312a039cc79d35be2dcb8aa20d91b31b9394c9fminfrin server within a response. Under exceptional circumstances,
f312a039cc79d35be2dcb8aa20d91b31b9394c9fminfrin <module>mod_cache</module> can be configured to override these headers
f312a039cc79d35be2dcb8aa20d91b31b9394c9fminfrin and force site specific behaviour, however such behaviour will be limited
f312a039cc79d35be2dcb8aa20d91b31b9394c9fminfrin to this cache only, and will not affect the operation of other caches
f312a039cc79d35be2dcb8aa20d91b31b9394c9fminfrin that may exist between the client and server, and as a result is not
f312a039cc79d35be2dcb8aa20d91b31b9394c9fminfrin recommended unless strictly necessary.</p>
f312a039cc79d35be2dcb8aa20d91b31b9394c9fminfrin
f312a039cc79d35be2dcb8aa20d91b31b9394c9fminfrin <p>RFC 2616 allows for the cache to return stale data while the existing
f312a039cc79d35be2dcb8aa20d91b31b9394c9fminfrin stale entry is refreshed from the origin server, and this is supported
f312a039cc79d35be2dcb8aa20d91b31b9394c9fminfrin by <module>mod_cache</module> when the
f312a039cc79d35be2dcb8aa20d91b31b9394c9fminfrin <directive module="mod_cache">CacheLock</directive> directive is suitably
f312a039cc79d35be2dcb8aa20d91b31b9394c9fminfrin configured. Such responses will contain a
f312a039cc79d35be2dcb8aa20d91b31b9394c9fminfrin <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.46">Warning</a>
f312a039cc79d35be2dcb8aa20d91b31b9394c9fminfrin HTTP header with a 110 response code. RFC 2616 also allows a cache to return
f312a039cc79d35be2dcb8aa20d91b31b9394c9fminfrin stale data when the attempt made to refresh the stale data returns an
f312a039cc79d35be2dcb8aa20d91b31b9394c9fminfrin error 500 or above, and this behaviour is supported by default by
f312a039cc79d35be2dcb8aa20d91b31b9394c9fminfrin <module>mod_cache</module>. Such responses will contain a
f312a039cc79d35be2dcb8aa20d91b31b9394c9fminfrin <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.46">Warning</a>
f312a039cc79d35be2dcb8aa20d91b31b9394c9fminfrin HTTP header with a 111 response code.</p>
f312a039cc79d35be2dcb8aa20d91b31b9394c9fminfrin
f312a039cc79d35be2dcb8aa20d91b31b9394c9fminfrin <p><module>mod_cache</module> requires the services of one or more
f312a039cc79d35be2dcb8aa20d91b31b9394c9fminfrin storage management modules. One storage management module is included in
3e5f26422e7931e8838f3c844adc4282ef269cdfstoddard the base Apache distribution:</p>
3ec4de296cf8eb31d8a59811b58720efafccf109patrikj <dl>
78f97ce162b66a0dbfd7af4dcd9984f162569b04minfrin <dt><module>mod_cache_disk</module></dt>
f312a039cc79d35be2dcb8aa20d91b31b9394c9fminfrin <dd>Implements a disk based storage manager. Headers and bodies are
f312a039cc79d35be2dcb8aa20d91b31b9394c9fminfrin stored separately on disk, in a directory structure derived from the
f312a039cc79d35be2dcb8aa20d91b31b9394c9fminfrin md5 hash of the cached URL. Multiple content negotiated responses can
f312a039cc79d35be2dcb8aa20d91b31b9394c9fminfrin be stored concurrently, however the caching of partial content is not
f312a039cc79d35be2dcb8aa20d91b31b9394c9fminfrin supported by this module. The <program>htcacheclean</program> tool is
f312a039cc79d35be2dcb8aa20d91b31b9394c9fminfrin provided to list cached URLs, remove cached URLs, or to maintain the size
f312a039cc79d35be2dcb8aa20d91b31b9394c9fminfrin of the disk cache within size and inode limits.</dd>
3ec4de296cf8eb31d8a59811b58720efafccf109patrikj </dl>
15f37a157fbbf107658ed82ec30c348a9b6e518end
b536777217c919cacb1a6f18eaeff001f3b3f13crbowen <p>Further details, discussion, and examples, are provided in the
b536777217c919cacb1a6f18eaeff001f3b3f13crbowen <a href="/caching.html">Caching Guide</a>.</p>
88c775368960b64afcdfd93a812f466a109746baerikabele</summary>
b536777217c919cacb1a6f18eaeff001f3b3f13crbowen<seealso><a href="/caching.html">Caching Guide</a></seealso>
1e5b300cc68389a18fe3762b1b980b0c86712ba1stoddard
88c775368960b64afcdfd93a812f466a109746baerikabele<section id="related"><title>Related Modules and Directives</title>
1e5b300cc68389a18fe3762b1b980b0c86712ba1stoddard <related>
1e5b300cc68389a18fe3762b1b980b0c86712ba1stoddard <modulelist>
78f97ce162b66a0dbfd7af4dcd9984f162569b04minfrin <module>mod_cache_disk</module>
1e5b300cc68389a18fe3762b1b980b0c86712ba1stoddard </modulelist>
1e5b300cc68389a18fe3762b1b980b0c86712ba1stoddard <directivelist>
78f97ce162b66a0dbfd7af4dcd9984f162569b04minfrin <directive module="mod_cache_disk">CacheRoot</directive>
78f97ce162b66a0dbfd7af4dcd9984f162569b04minfrin <directive module="mod_cache_disk">CacheDirLevels</directive>
78f97ce162b66a0dbfd7af4dcd9984f162569b04minfrin <directive module="mod_cache_disk">CacheDirLength</directive>
78f97ce162b66a0dbfd7af4dcd9984f162569b04minfrin <directive module="mod_cache_disk">CacheMinFileSize</directive>
78f97ce162b66a0dbfd7af4dcd9984f162569b04minfrin <directive module="mod_cache_disk">CacheMaxFileSize</directive>
1e5b300cc68389a18fe3762b1b980b0c86712ba1stoddard </directivelist>
1e5b300cc68389a18fe3762b1b980b0c86712ba1stoddard </related>
88c775368960b64afcdfd93a812f466a109746baerikabele</section>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard
15f37a157fbbf107658ed82ec30c348a9b6e518end<section id="sampleconf"><title>Sample Configuration</title>
15f37a157fbbf107658ed82ec30c348a9b6e518end <example><title>Sample httpd.conf</title>
15f37a157fbbf107658ed82ec30c348a9b6e518end #<br />
15f37a157fbbf107658ed82ec30c348a9b6e518end # Sample Cache Configuration<br />
15f37a157fbbf107658ed82ec30c348a9b6e518end #<br />
15f37a157fbbf107658ed82ec30c348a9b6e518end LoadModule cache_module modules/mod_cache.so<br />
15f37a157fbbf107658ed82ec30c348a9b6e518end <br />
15f37a157fbbf107658ed82ec30c348a9b6e518end &lt;IfModule mod_cache.c&gt;<br />
15f37a157fbbf107658ed82ec30c348a9b6e518end <indent>
78f97ce162b66a0dbfd7af4dcd9984f162569b04minfrin LoadModule cache_disk_module modules/mod_cache_disk.so<br />
78f97ce162b66a0dbfd7af4dcd9984f162569b04minfrin &lt;IfModule mod_cache_disk.c&gt;<br />
15f37a157fbbf107658ed82ec30c348a9b6e518end <indent>
15f37a157fbbf107658ed82ec30c348a9b6e518end CacheRoot c:/cacheroot<br />
15f37a157fbbf107658ed82ec30c348a9b6e518end CacheEnable disk /<br />
15f37a157fbbf107658ed82ec30c348a9b6e518end CacheDirLevels 5<br />
15f37a157fbbf107658ed82ec30c348a9b6e518end CacheDirLength 3<br />
15f37a157fbbf107658ed82ec30c348a9b6e518end </indent>
15f37a157fbbf107658ed82ec30c348a9b6e518end &lt;/IfModule&gt; <br />
15f37a157fbbf107658ed82ec30c348a9b6e518end <br />
89ebbccde2b87b469b9d6fdb606eeb943c12a824colm # When acting as a proxy, don't cache the list of security updates<br />
89ebbccde2b87b469b9d6fdb606eeb943c12a824colm CacheDisable http://security.update.server/update-list/<br />
15f37a157fbbf107658ed82ec30c348a9b6e518end </indent>
15f37a157fbbf107658ed82ec30c348a9b6e518end &lt;/IfModule&gt;
15f37a157fbbf107658ed82ec30c348a9b6e518end </example>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard</section>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard
3c67b7956d44501360506a9f13a5011be73b30ecminfrin<section id="thunderingherd"><title>Avoiding the Thundering Herd</title>
3c67b7956d44501360506a9f13a5011be73b30ecminfrin <p>When a cached entry becomes stale, <module>mod_cache</module> will submit
3c67b7956d44501360506a9f13a5011be73b30ecminfrin a conditional request to the backend, which is expected to confirm whether the
3c67b7956d44501360506a9f13a5011be73b30ecminfrin cached entry is still fresh, and send an updated entity if not.</p>
3c67b7956d44501360506a9f13a5011be73b30ecminfrin <p>A small but finite amount of time exists between the time the cached entity
3c67b7956d44501360506a9f13a5011be73b30ecminfrin becomes stale, and the time the stale entity is fully refreshed. On a busy
3c67b7956d44501360506a9f13a5011be73b30ecminfrin server, a significant number of requests might arrive during this time, and
3c67b7956d44501360506a9f13a5011be73b30ecminfrin cause a <strong>thundering herd</strong> of requests to strike the backend
3c67b7956d44501360506a9f13a5011be73b30ecminfrin suddenly and unpredicably.</p>
3c67b7956d44501360506a9f13a5011be73b30ecminfrin <p>To keep the thundering herd at bay, the <directive>CacheLock</directive>
3c67b7956d44501360506a9f13a5011be73b30ecminfrin directive can be used to define a directory in which locks are created for
3c67b7956d44501360506a9f13a5011be73b30ecminfrin URLs <strong>in flight</strong>. The lock is used as a <strong>hint</strong>
3c67b7956d44501360506a9f13a5011be73b30ecminfrin by other requests to either suppress an attempt to cache (someone else has
3c67b7956d44501360506a9f13a5011be73b30ecminfrin gone to fetch the entity), or to indicate that a stale entry is being refreshed
3c67b7956d44501360506a9f13a5011be73b30ecminfrin (stale content will be returned in the mean time).
3c67b7956d44501360506a9f13a5011be73b30ecminfrin </p>
3c67b7956d44501360506a9f13a5011be73b30ecminfrin <section>
3c67b7956d44501360506a9f13a5011be73b30ecminfrin <title>Initial caching of an entry</title>
3c67b7956d44501360506a9f13a5011be73b30ecminfrin <p>When an entity is cached for the first time, a lock will be created for the
3c67b7956d44501360506a9f13a5011be73b30ecminfrin entity until the response has been fully cached. During the lifetime of the
3c67b7956d44501360506a9f13a5011be73b30ecminfrin lock, the cache will suppress the second and subsequent attempt to cache the
3c67b7956d44501360506a9f13a5011be73b30ecminfrin same entity. While this doesn't hold back the thundering herd, it does stop
3c67b7956d44501360506a9f13a5011be73b30ecminfrin the cache attempting to cache the same entity multiple times simultaneously.
3c67b7956d44501360506a9f13a5011be73b30ecminfrin </p>
3c67b7956d44501360506a9f13a5011be73b30ecminfrin </section>
3c67b7956d44501360506a9f13a5011be73b30ecminfrin <section>
3c67b7956d44501360506a9f13a5011be73b30ecminfrin <title>Refreshment of a stale entry</title>
3c67b7956d44501360506a9f13a5011be73b30ecminfrin <p>When an entity reaches its freshness lifetime and becomes stale, a lock
3c67b7956d44501360506a9f13a5011be73b30ecminfrin will be created for the entity until the response has either been confirmed as
3c67b7956d44501360506a9f13a5011be73b30ecminfrin still fresh, or replaced by the backend. During the lifetime of the lock, the
3c67b7956d44501360506a9f13a5011be73b30ecminfrin second and subsequent incoming request will cause stale data to be returned,
3c67b7956d44501360506a9f13a5011be73b30ecminfrin and the thundering herd is kept at bay.</p>
3c67b7956d44501360506a9f13a5011be73b30ecminfrin </section>
3c67b7956d44501360506a9f13a5011be73b30ecminfrin <section>
3c67b7956d44501360506a9f13a5011be73b30ecminfrin <title>Locks and Cache-Control: no-cache</title>
3c67b7956d44501360506a9f13a5011be73b30ecminfrin <p>Locks are used as a <strong>hint only</strong> to enable the cache to be
3c67b7956d44501360506a9f13a5011be73b30ecminfrin more gentle on backend servers, however the lock can be overridden if necessary.
3c67b7956d44501360506a9f13a5011be73b30ecminfrin If the client sends a request with a Cache-Control header forcing a reload, any
3c67b7956d44501360506a9f13a5011be73b30ecminfrin lock that may be present will be ignored, and the client's request will be
b751f61885edfa8975b02c59b9604d202ffcb9bfrbowen honored immediately and the cached entry refreshed.</p>
3c67b7956d44501360506a9f13a5011be73b30ecminfrin <p>As a further safety mechanism, locks have a configurable maximum age.
3c67b7956d44501360506a9f13a5011be73b30ecminfrin Once this age has been reached, the lock is removed, and a new request is
3c67b7956d44501360506a9f13a5011be73b30ecminfrin given the opportunity to create a new lock. This maximum age can be set using
3c67b7956d44501360506a9f13a5011be73b30ecminfrin the <directive>CacheLockMaxAge</directive> directive, and defaults to 5
3c67b7956d44501360506a9f13a5011be73b30ecminfrin seconds.
3c67b7956d44501360506a9f13a5011be73b30ecminfrin </p>
3c67b7956d44501360506a9f13a5011be73b30ecminfrin </section>
3c67b7956d44501360506a9f13a5011be73b30ecminfrin <section>
3c67b7956d44501360506a9f13a5011be73b30ecminfrin <title>Example configuration</title>
3c67b7956d44501360506a9f13a5011be73b30ecminfrin <example><title>Enabling the cache lock</title>
3c67b7956d44501360506a9f13a5011be73b30ecminfrin #<br />
3c67b7956d44501360506a9f13a5011be73b30ecminfrin # Enable the cache lock<br />
3c67b7956d44501360506a9f13a5011be73b30ecminfrin #<br />
3c67b7956d44501360506a9f13a5011be73b30ecminfrin &lt;IfModule mod_cache.c&gt;<br />
3c67b7956d44501360506a9f13a5011be73b30ecminfrin <indent>
3c67b7956d44501360506a9f13a5011be73b30ecminfrin CacheLock on<br />
3c67b7956d44501360506a9f13a5011be73b30ecminfrin CacheLockPath /tmp/mod_cache-lock<br />
3c67b7956d44501360506a9f13a5011be73b30ecminfrin CacheLockMaxAge 5<br />
3c67b7956d44501360506a9f13a5011be73b30ecminfrin </indent>
3c67b7956d44501360506a9f13a5011be73b30ecminfrin &lt;/IfModule&gt;
3c67b7956d44501360506a9f13a5011be73b30ecminfrin </example>
3c67b7956d44501360506a9f13a5011be73b30ecminfrin </section>
3c67b7956d44501360506a9f13a5011be73b30ecminfrin</section>
3c67b7956d44501360506a9f13a5011be73b30ecminfrin
7b467aa53854c95318a1c709709c1619a4f47118minfrin<section id="finecontrol"><title>Fine Control with the CACHE Filter</title>
7b467aa53854c95318a1c709709c1619a4f47118minfrin <p>Under the default mode of cache operation, the cache runs as a quick handler,
7b467aa53854c95318a1c709709c1619a4f47118minfrin short circuiting the majority of server processing and offering the highest
7b467aa53854c95318a1c709709c1619a4f47118minfrin cache performance available.</p>
860b4efe27e7c1c9a2bf5c872b29c90f76849b51jim
7b467aa53854c95318a1c709709c1619a4f47118minfrin <p>In this mode, the cache <strong>bolts onto</strong> the front of the server,
f312a039cc79d35be2dcb8aa20d91b31b9394c9fminfrin acting as if a free standing RFC 2616 caching proxy had been placed in front of
7b467aa53854c95318a1c709709c1619a4f47118minfrin the server.</p>
860b4efe27e7c1c9a2bf5c872b29c90f76849b51jim
7b467aa53854c95318a1c709709c1619a4f47118minfrin <p>While this mode offers the best performance, the administrator may find that
7b467aa53854c95318a1c709709c1619a4f47118minfrin under certain circumstances they may want to perform further processing on the
7b467aa53854c95318a1c709709c1619a4f47118minfrin request after the request is cached, such as to inject personalisation into the
7b467aa53854c95318a1c709709c1619a4f47118minfrin cached page, or to apply authorisation restrictions to the content. Under these
7b467aa53854c95318a1c709709c1619a4f47118minfrin circumstances, an administrator is often forced to place independent reverse
7b467aa53854c95318a1c709709c1619a4f47118minfrin proxy servers either behind or in front of the caching server to achieve this.</p>
7b467aa53854c95318a1c709709c1619a4f47118minfrin
7b467aa53854c95318a1c709709c1619a4f47118minfrin <p>To solve this problem the <directive module="mod_cache">CacheQuickHandler
7b467aa53854c95318a1c709709c1619a4f47118minfrin </directive> directive can be set to <strong>off</strong>, and the server will
1fd5131d5732e639b0b4225ca0afea717c41bc11trawick process all phases normally handled by a non-cached request, including the
7b467aa53854c95318a1c709709c1619a4f47118minfrin <strong>authentication and authorisation</strong> phases.</p>
7b467aa53854c95318a1c709709c1619a4f47118minfrin
7b467aa53854c95318a1c709709c1619a4f47118minfrin <p>In addition, the administrator may optionally specify the <strong>precise point
7b467aa53854c95318a1c709709c1619a4f47118minfrin within the filter chain</strong> where caching is to take place by adding the
7b467aa53854c95318a1c709709c1619a4f47118minfrin <strong>CACHE</strong> filter to the output filter chain.</p>
7b467aa53854c95318a1c709709c1619a4f47118minfrin
7b467aa53854c95318a1c709709c1619a4f47118minfrin <p>For example, to cache content before applying compression to the response,
7b467aa53854c95318a1c709709c1619a4f47118minfrin place the <strong>CACHE</strong> filter before the <strong>DEFLATE</strong>
7b467aa53854c95318a1c709709c1619a4f47118minfrin filter as in the example below:</p>
7b467aa53854c95318a1c709709c1619a4f47118minfrin
7b467aa53854c95318a1c709709c1619a4f47118minfrin <example>
7b467aa53854c95318a1c709709c1619a4f47118minfrin # Cache content before optional compression<br />
7b467aa53854c95318a1c709709c1619a4f47118minfrin CacheQuickHandler off<br />
7b467aa53854c95318a1c709709c1619a4f47118minfrin AddOutputFilterByType CACHE;DEFLATE text/plain<br /><br />
7b467aa53854c95318a1c709709c1619a4f47118minfrin </example>
7b467aa53854c95318a1c709709c1619a4f47118minfrin
7b467aa53854c95318a1c709709c1619a4f47118minfrin <p>Another option is to have content cached before personalisation is applied
7b467aa53854c95318a1c709709c1619a4f47118minfrin by <module>mod_include</module> (or another content processing filter). In this
7b467aa53854c95318a1c709709c1619a4f47118minfrin example templates containing tags understood by
7b467aa53854c95318a1c709709c1619a4f47118minfrin <module>mod_include</module> are cached before being parsed:</p>
7b467aa53854c95318a1c709709c1619a4f47118minfrin
7b467aa53854c95318a1c709709c1619a4f47118minfrin <example>
7b467aa53854c95318a1c709709c1619a4f47118minfrin # Cache content before mod_include and mod_deflate<br />
7b467aa53854c95318a1c709709c1619a4f47118minfrin CacheQuickHandler off<br />
7b467aa53854c95318a1c709709c1619a4f47118minfrin AddOutputFilterByType CACHE;INCLUDES;DEFLATE text/html<br /><br />
7b467aa53854c95318a1c709709c1619a4f47118minfrin </example>
7b467aa53854c95318a1c709709c1619a4f47118minfrin
7b467aa53854c95318a1c709709c1619a4f47118minfrin <p>You may place the <strong>CACHE</strong> filter anywhere you wish within the
7b467aa53854c95318a1c709709c1619a4f47118minfrin filter chain. In this example, content is cached after being parsed by
7b467aa53854c95318a1c709709c1619a4f47118minfrin <module>mod_include</module>, but before being processed by
7b467aa53854c95318a1c709709c1619a4f47118minfrin <module>mod_deflate</module>:</p>
7b467aa53854c95318a1c709709c1619a4f47118minfrin
7b467aa53854c95318a1c709709c1619a4f47118minfrin <example>
7b467aa53854c95318a1c709709c1619a4f47118minfrin # Cache content between mod_include and mod_deflate<br />
7b467aa53854c95318a1c709709c1619a4f47118minfrin CacheQuickHandler off<br />
7b467aa53854c95318a1c709709c1619a4f47118minfrin AddOutputFilterByType INCLUDES;CACHE;DEFLATE text/html<br /><br />
7b467aa53854c95318a1c709709c1619a4f47118minfrin </example>
7b467aa53854c95318a1c709709c1619a4f47118minfrin
7b467aa53854c95318a1c709709c1619a4f47118minfrin <note type="warning"><title>Warning:</title>If the location of the
7b467aa53854c95318a1c709709c1619a4f47118minfrin <strong>CACHE</strong> filter in the filter chain is changed for any reason,
7b467aa53854c95318a1c709709c1619a4f47118minfrin you may need to <strong>flush your cache</strong> to ensure that your data
7b467aa53854c95318a1c709709c1619a4f47118minfrin served remains consistent. <module>mod_cache</module> is not in a position
7b467aa53854c95318a1c709709c1619a4f47118minfrin to enforce this for you.</note>
7b467aa53854c95318a1c709709c1619a4f47118minfrin
7b467aa53854c95318a1c709709c1619a4f47118minfrin</section>
7b467aa53854c95318a1c709709c1619a4f47118minfrin
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin<section id="status"><title>Cache Status and Logging</title>
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin <p>Once <module>mod_cache</module> has made a decision as to whether or not
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin an entity is to be served from cache, the detailed reason for the decision
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin is written to the subprocess environment within the request under the
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin <strong>cache-status</strong> key. This reason can be logged by the
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin <directive module="mod_log_config">LogFormat</directive> directive as
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin follows:</p>
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin <example>
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin LogFormat "%{cache-status}e ..."
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin </example>
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin <p>Based on the caching decision made, the reason is also written to the
da40dfabefd6f8eb8450e9a097c594ee2ab13e3eminfrin subprocess environment under one the following four keys, as appropriate:</p>
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin <dl>
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin <dt>cache-hit</dt><dd>The response was served from cache.</dd>
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin <dt>cache-revalidate</dt><dd>The response was stale and was successfully
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin revalidated, then served from cache.</dd>
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin <dt>cache-miss</dt><dd>The response was served from the upstream server.</dd>
da40dfabefd6f8eb8450e9a097c594ee2ab13e3eminfrin <dt>cache-invalidate</dt><dd>The cached entity was invalidated by a request
da40dfabefd6f8eb8450e9a097c594ee2ab13e3eminfrin method other than GET or HEAD.</dd>
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin </dl>
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin <p>This makes it possible to support conditional logging of cached requests
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin as per the following example:</p>
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin <example>
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin CustomLog cached-requests.log common env=cache-hit<br />
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin CustomLog uncached-requests.log common env=cache-miss<br />
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin CustomLog revalidated-requests.log common env=cache-revalidate<br />
da40dfabefd6f8eb8450e9a097c594ee2ab13e3eminfrin CustomLog invalidated-requests.log common env=cache-invalidate<br />
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin </example>
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin
da40dfabefd6f8eb8450e9a097c594ee2ab13e3eminfrin <p>For module authors, a hook called <var>cache_status</var> is available,
da40dfabefd6f8eb8450e9a097c594ee2ab13e3eminfrin allowing modules to respond to the caching outcomes above in customised
da40dfabefd6f8eb8450e9a097c594ee2ab13e3eminfrin ways.</p>
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin</section>
da40dfabefd6f8eb8450e9a097c594ee2ab13e3eminfrin
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard<directivesynopsis>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard<name>CacheEnable</name>
62e52789bfc10a5fd0a433af77e77c8ebbbed6c2rederpj<description>Enable caching of specified URLs using a specified storage
15f37a157fbbf107658ed82ec30c348a9b6e518endmanager</description>
ffae06377667a5d8f9699ac7512134de7000a83dminfrin<syntax>CacheEnable <var>cache_type</var> [<var>url-string</var>]</syntax>
15f37a157fbbf107658ed82ec30c348a9b6e518end<contextlist><context>server config</context><context>virtual host</context>
ffae06377667a5d8f9699ac7512134de7000a83dminfrin<context>directory</context><context>.htaccess</context>
15f37a157fbbf107658ed82ec30c348a9b6e518end</contextlist>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard<usage>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard <p>The <directive>CacheEnable</directive> directive instructs
15f37a157fbbf107658ed82ec30c348a9b6e518end <module>mod_cache</module> to cache urls at or below
62e52789bfc10a5fd0a433af77e77c8ebbbed6c2rederpj <var>url-string</var>. The cache storage manager is specified with the
ffae06377667a5d8f9699ac7512134de7000a83dminfrin <var>cache_type</var> argument. The <directive>CacheEnable</directive>
ffae06377667a5d8f9699ac7512134de7000a83dminfrin directive can alternatively be placed inside either
ffae06377667a5d8f9699ac7512134de7000a83dminfrin <directive type="section">Location</directive> or
ffae06377667a5d8f9699ac7512134de7000a83dminfrin <directive type="section">LocationMatch</directive> sections to indicate
ffae06377667a5d8f9699ac7512134de7000a83dminfrin the content is cacheable.
15f37a157fbbf107658ed82ec30c348a9b6e518end <var>cache_type</var> <code>disk</code> instructs
62e52789bfc10a5fd0a433af77e77c8ebbbed6c2rederpj <module>mod_cache</module> to use the disk based storage manager
78f97ce162b66a0dbfd7af4dcd9984f162569b04minfrin implemented by <module>mod_cache_disk</module>.</p>
62e52789bfc10a5fd0a433af77e77c8ebbbed6c2rederpj <p>In the event that the URL space overlaps between different
62e52789bfc10a5fd0a433af77e77c8ebbbed6c2rederpj <directive>CacheEnable</directive> directives (as in the example below),
62e52789bfc10a5fd0a433af77e77c8ebbbed6c2rederpj each possible storage manager will be run until the first one that
62e52789bfc10a5fd0a433af77e77c8ebbbed6c2rederpj actually processes the request. The order in which the storage managers are
62e52789bfc10a5fd0a433af77e77c8ebbbed6c2rederpj run is determined by the order of the <directive>CacheEnable</directive>
ffae06377667a5d8f9699ac7512134de7000a83dminfrin directives in the configuration file. <directive>CacheEnable</directive>
ffae06377667a5d8f9699ac7512134de7000a83dminfrin directives within <directive type="section">Location</directive> or
ffae06377667a5d8f9699ac7512134de7000a83dminfrin <directive type="section">LocationMatch</directive> sections are processed
ffae06377667a5d8f9699ac7512134de7000a83dminfrin before globally defined <directive>CacheEnable</directive> directives.</p>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard
89ebbccde2b87b469b9d6fdb606eeb943c12a824colm <p>When acting as a forward proxy server, <var>url-string</var> can
860b4efe27e7c1c9a2bf5c872b29c90f76849b51jim also be used to specify remote sites and proxy protocols which
89ebbccde2b87b469b9d6fdb606eeb943c12a824colm caching should be enabled for.</p>
ffae06377667a5d8f9699ac7512134de7000a83dminfrin
89ebbccde2b87b469b9d6fdb606eeb943c12a824colm <example>
ffae06377667a5d8f9699ac7512134de7000a83dminfrin # Cache content<br />
ffae06377667a5d8f9699ac7512134de7000a83dminfrin &lt;Location /foo&gt;<br />
ffae06377667a5d8f9699ac7512134de7000a83dminfrin <indent>
ffae06377667a5d8f9699ac7512134de7000a83dminfrin CacheEnable disk<br />
ffae06377667a5d8f9699ac7512134de7000a83dminfrin </indent>
ffae06377667a5d8f9699ac7512134de7000a83dminfrin &lt;/Location&gt;<br /><br />
ffae06377667a5d8f9699ac7512134de7000a83dminfrin # Cache regex<br />
ffae06377667a5d8f9699ac7512134de7000a83dminfrin &lt;LocationMatch foo$&gt;<br />
ffae06377667a5d8f9699ac7512134de7000a83dminfrin <indent>
ffae06377667a5d8f9699ac7512134de7000a83dminfrin CacheEnable disk<br />
ffae06377667a5d8f9699ac7512134de7000a83dminfrin </indent>
ffae06377667a5d8f9699ac7512134de7000a83dminfrin &lt;/LocationMatch&gt;<br /><br />
89ebbccde2b87b469b9d6fdb606eeb943c12a824colm # Cache proxied url's<br />
89ebbccde2b87b469b9d6fdb606eeb943c12a824colm CacheEnable disk /<br /><br />
89ebbccde2b87b469b9d6fdb606eeb943c12a824colm # Cache FTP-proxied url's<br />
89ebbccde2b87b469b9d6fdb606eeb943c12a824colm CacheEnable disk ftp://<br /><br />
a330659fa32865eb8521adaccf5d9b75687b9aebtrawick # Cache content from www.example.org<br />
a330659fa32865eb8521adaccf5d9b75687b9aebtrawick CacheEnable disk http://www.example.org/<br />
89ebbccde2b87b469b9d6fdb606eeb943c12a824colm </example>
89ebbccde2b87b469b9d6fdb606eeb943c12a824colm
2af38cc44e48753913565b38a7a9f325f898a293minfrin <p>A hostname starting with a <strong>"*"</strong> matches all hostnames with
2af38cc44e48753913565b38a7a9f325f898a293minfrin that suffix. A hostname starting with <strong>"."</strong> matches all
2af38cc44e48753913565b38a7a9f325f898a293minfrin hostnames containing the domain components that follow.</p>
2af38cc44e48753913565b38a7a9f325f898a293minfrin
2af38cc44e48753913565b38a7a9f325f898a293minfrin <example>
a330659fa32865eb8521adaccf5d9b75687b9aebtrawick # Match www.example.org, and fooexample.org<br />
a330659fa32865eb8521adaccf5d9b75687b9aebtrawick CacheEnable disk http://*example.org/<br />
a330659fa32865eb8521adaccf5d9b75687b9aebtrawick # Match www.example.org, but not fooexample.org<br />
a330659fa32865eb8521adaccf5d9b75687b9aebtrawick CacheEnable disk http://.example.org/<br />
2af38cc44e48753913565b38a7a9f325f898a293minfrin </example>
2af38cc44e48753913565b38a7a9f325f898a293minfrin
860b4efe27e7c1c9a2bf5c872b29c90f76849b51jim <p> The <code>no-cache</code> environment variable can be set to
da7952dfad53cb6344b3fd2128241d3f9c6ed6cbcovener disable caching on a finer grained set of resources in versions
b4f25203520c168e2df9f7d83024db09e68efe7ecovener 2.2.12 and later.</p>
8d36abdf61277cb8ffcecc763c8a86c28f11f8e9covener
15f37a157fbbf107658ed82ec30c348a9b6e518end</usage>
8d36abdf61277cb8ffcecc763c8a86c28f11f8e9covener<seealso><a href="/env.html">Environment Variables in Apache</a></seealso>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard</directivesynopsis>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard<directivesynopsis>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard<name>CacheDisable</name>
62e52789bfc10a5fd0a433af77e77c8ebbbed6c2rederpj<description>Disable caching of specified URLs</description>
ed6dfb7d7057dc4f42348f12d7bff9fe98fc73cfminfrin<syntax>CacheDisable <var>url-string</var> | <var>on</var></syntax>
15f37a157fbbf107658ed82ec30c348a9b6e518end<contextlist><context>server config</context><context>virtual host</context>
ffae06377667a5d8f9699ac7512134de7000a83dminfrin<context>directory</context><context>.htaccess</context>
15f37a157fbbf107658ed82ec30c348a9b6e518end</contextlist>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard<usage>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard <p>The <directive>CacheDisable</directive> directive instructs
15f37a157fbbf107658ed82ec30c348a9b6e518end <module>mod_cache</module> to <em>not</em> cache urls at or below
15f37a157fbbf107658ed82ec30c348a9b6e518end <var>url-string</var>.</p>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard
15f37a157fbbf107658ed82ec30c348a9b6e518end <example><title>Example</title>
62e52789bfc10a5fd0a433af77e77c8ebbbed6c2rederpj CacheDisable /local_files
15f37a157fbbf107658ed82ec30c348a9b6e518end </example>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard
ed6dfb7d7057dc4f42348f12d7bff9fe98fc73cfminfrin <p>If used in a <directive type="section">Location</directive> directive,
ed6dfb7d7057dc4f42348f12d7bff9fe98fc73cfminfrin the path needs to be specified below the Location, or if the word "on"
ed6dfb7d7057dc4f42348f12d7bff9fe98fc73cfminfrin is used, caching for the whole location will be disabled.</p>
ed6dfb7d7057dc4f42348f12d7bff9fe98fc73cfminfrin
ed6dfb7d7057dc4f42348f12d7bff9fe98fc73cfminfrin <example><title>Example</title>
ed6dfb7d7057dc4f42348f12d7bff9fe98fc73cfminfrin &lt;Location /foo&gt;<br />
ffae06377667a5d8f9699ac7512134de7000a83dminfrin <indent>
ed6dfb7d7057dc4f42348f12d7bff9fe98fc73cfminfrin CacheDisable on<br />
ffae06377667a5d8f9699ac7512134de7000a83dminfrin </indent>
ed6dfb7d7057dc4f42348f12d7bff9fe98fc73cfminfrin &lt;/Location&gt;<br />
ed6dfb7d7057dc4f42348f12d7bff9fe98fc73cfminfrin </example>
ed6dfb7d7057dc4f42348f12d7bff9fe98fc73cfminfrin
860b4efe27e7c1c9a2bf5c872b29c90f76849b51jim <p>The <code>no-cache</code> environment variable can be set to
da7952dfad53cb6344b3fd2128241d3f9c6ed6cbcovener disable caching on a finer grained set of resources in versions
b4f25203520c168e2df9f7d83024db09e68efe7ecovener 2.2.12 and later.</p>
da7952dfad53cb6344b3fd2128241d3f9c6ed6cbcovener
8d36abdf61277cb8ffcecc763c8a86c28f11f8e9covener</usage>
8d36abdf61277cb8ffcecc763c8a86c28f11f8e9covener<seealso><a href="/env.html">Environment Variables in Apache</a></seealso>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard</directivesynopsis>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard<directivesynopsis>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard<name>CacheMaxExpire</name>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard<description>The maximum time in seconds to cache a document</description>
15f37a157fbbf107658ed82ec30c348a9b6e518end<syntax>CacheMaxExpire <var>seconds</var></syntax>
88c775368960b64afcdfd93a812f466a109746baerikabele<default>CacheMaxExpire 86400 (one day)</default>
4cefc38158672f5de8119886d9754cf0609a9371minfrin<contextlist><context>server config</context>
4cefc38158672f5de8119886d9754cf0609a9371minfrin <context>virtual host</context>
4cefc38158672f5de8119886d9754cf0609a9371minfrin <context>directory</context>
4cefc38158672f5de8119886d9754cf0609a9371minfrin <context>.htaccess</context>
15f37a157fbbf107658ed82ec30c348a9b6e518end</contextlist>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard<usage>
62e52789bfc10a5fd0a433af77e77c8ebbbed6c2rederpj <p>The <directive>CacheMaxExpire</directive> directive specifies the maximum number of
62e52789bfc10a5fd0a433af77e77c8ebbbed6c2rederpj seconds for which cachable HTTP documents will be retained without checking the origin
62e52789bfc10a5fd0a433af77e77c8ebbbed6c2rederpj server. Thus, documents will be out of date at most this number of seconds. This maximum
62e52789bfc10a5fd0a433af77e77c8ebbbed6c2rederpj value is enforced even if an expiry date was supplied with the document.</p>
15f37a157fbbf107658ed82ec30c348a9b6e518end
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard <example>
15f37a157fbbf107658ed82ec30c348a9b6e518end CacheMaxExpire 604800
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard </example>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard</usage>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard</directivesynopsis>
15f37a157fbbf107658ed82ec30c348a9b6e518end
1b0dce86d7fc8a5aa4c89b05255be26e508c615crpluem<directivesynopsis>
1b0dce86d7fc8a5aa4c89b05255be26e508c615crpluem<name>CacheMinExpire</name>
1b0dce86d7fc8a5aa4c89b05255be26e508c615crpluem<description>The minimum time in seconds to cache a document</description>
1b0dce86d7fc8a5aa4c89b05255be26e508c615crpluem<syntax>CacheMinExpire <var>seconds</var></syntax>
1b0dce86d7fc8a5aa4c89b05255be26e508c615crpluem<default>CacheMinExpire 0</default>
4cefc38158672f5de8119886d9754cf0609a9371minfrin<contextlist><context>server config</context>
4cefc38158672f5de8119886d9754cf0609a9371minfrin <context>virtual host</context>
4cefc38158672f5de8119886d9754cf0609a9371minfrin <context>directory</context>
4cefc38158672f5de8119886d9754cf0609a9371minfrin <context>.htaccess</context>
1b0dce86d7fc8a5aa4c89b05255be26e508c615crpluem</contextlist>
1b0dce86d7fc8a5aa4c89b05255be26e508c615crpluem
1b0dce86d7fc8a5aa4c89b05255be26e508c615crpluem<usage>
1b0dce86d7fc8a5aa4c89b05255be26e508c615crpluem <p>The <directive>CacheMinExpire</directive> directive specifies the minimum number of
1b0dce86d7fc8a5aa4c89b05255be26e508c615crpluem seconds for which cachable HTTP documents will be retained without checking the origin
1b0dce86d7fc8a5aa4c89b05255be26e508c615crpluem server. This is only used if no valid expire time was supplied with the document.</p>
1b0dce86d7fc8a5aa4c89b05255be26e508c615crpluem
1b0dce86d7fc8a5aa4c89b05255be26e508c615crpluem
1b0dce86d7fc8a5aa4c89b05255be26e508c615crpluem <example>
1b0dce86d7fc8a5aa4c89b05255be26e508c615crpluem CacheMinExpire 3600
1b0dce86d7fc8a5aa4c89b05255be26e508c615crpluem </example>
1b0dce86d7fc8a5aa4c89b05255be26e508c615crpluem</usage>
1b0dce86d7fc8a5aa4c89b05255be26e508c615crpluem</directivesynopsis>
1b0dce86d7fc8a5aa4c89b05255be26e508c615crpluem
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard<directivesynopsis>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard<name>CacheDefaultExpire</name>
62e52789bfc10a5fd0a433af77e77c8ebbbed6c2rederpj<description>The default duration to cache a document when no expiry date is specified.</description>
15f37a157fbbf107658ed82ec30c348a9b6e518end<syntax>CacheDefaultExpire <var>seconds</var></syntax>
88c775368960b64afcdfd93a812f466a109746baerikabele<default>CacheDefaultExpire 3600 (one hour)</default>
4cefc38158672f5de8119886d9754cf0609a9371minfrin<contextlist><context>server config</context>
4cefc38158672f5de8119886d9754cf0609a9371minfrin <context>virtual host</context>
4cefc38158672f5de8119886d9754cf0609a9371minfrin <context>directory</context>
4cefc38158672f5de8119886d9754cf0609a9371minfrin <context>.htaccess</context>
15f37a157fbbf107658ed82ec30c348a9b6e518end</contextlist>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard<usage>
62e52789bfc10a5fd0a433af77e77c8ebbbed6c2rederpj <p>The <directive>CacheDefaultExpire</directive> directive specifies a default time,
62e52789bfc10a5fd0a433af77e77c8ebbbed6c2rederpj in seconds, to cache a document if neither an expiry date nor last-modified date are provided
62e52789bfc10a5fd0a433af77e77c8ebbbed6c2rederpj with the document. The value specified with the <directive>CacheMaxExpire</directive>
62e52789bfc10a5fd0a433af77e77c8ebbbed6c2rederpj directive does <em>not</em> override this setting.</p>
15f37a157fbbf107658ed82ec30c348a9b6e518end
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard <example>
15f37a157fbbf107658ed82ec30c348a9b6e518end CacheDefaultExpire 86400
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard </example>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard</usage>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard</directivesynopsis>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard<directivesynopsis>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard<name>CacheIgnoreNoLastMod</name>
62e52789bfc10a5fd0a433af77e77c8ebbbed6c2rederpj<description>Ignore the fact that a response has no Last Modified
62e52789bfc10a5fd0a433af77e77c8ebbbed6c2rederpjheader.</description>
15f37a157fbbf107658ed82ec30c348a9b6e518end<syntax>CacheIgnoreNoLastMod On|Off</syntax>
15f37a157fbbf107658ed82ec30c348a9b6e518end<default>CacheIgnoreNoLastMod Off</default>
4cefc38158672f5de8119886d9754cf0609a9371minfrin<contextlist><context>server config</context>
4cefc38158672f5de8119886d9754cf0609a9371minfrin <context>virtual host</context>
4cefc38158672f5de8119886d9754cf0609a9371minfrin <context>directory</context>
4cefc38158672f5de8119886d9754cf0609a9371minfrin <context>.htaccess</context>
15f37a157fbbf107658ed82ec30c348a9b6e518end</contextlist>
860b4efe27e7c1c9a2bf5c872b29c90f76849b51jim
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard<usage>
62e52789bfc10a5fd0a433af77e77c8ebbbed6c2rederpj <p>Ordinarily, documents without a last-modified date are not cached.
62e52789bfc10a5fd0a433af77e77c8ebbbed6c2rederpj Under some circumstances the last-modified date is removed (during
62e52789bfc10a5fd0a433af77e77c8ebbbed6c2rederpj <module>mod_include</module> processing for example) or not provided
62e52789bfc10a5fd0a433af77e77c8ebbbed6c2rederpj at all. The <directive>CacheIgnoreNoLastMod</directive> directive
62e52789bfc10a5fd0a433af77e77c8ebbbed6c2rederpj provides a way to specify that documents without last-modified dates
62e52789bfc10a5fd0a433af77e77c8ebbbed6c2rederpj should be considered for caching, even without a last-modified date.
62e52789bfc10a5fd0a433af77e77c8ebbbed6c2rederpj If neither a last-modified date nor an expiry date are provided with
62e52789bfc10a5fd0a433af77e77c8ebbbed6c2rederpj the document then the value specified by the
62e52789bfc10a5fd0a433af77e77c8ebbbed6c2rederpj <directive>CacheDefaultExpire</directive> directive will be used to
62e52789bfc10a5fd0a433af77e77c8ebbbed6c2rederpj generate an expiration date.</p>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard <example>
15f37a157fbbf107658ed82ec30c348a9b6e518end CacheIgnoreNoLastMod On
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard </example>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard</usage>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard</directivesynopsis>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard<directivesynopsis>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard<name>CacheIgnoreCacheControl</name>
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz<description>Ignore request to not serve cached content to client</description>
15f37a157fbbf107658ed82ec30c348a9b6e518end<syntax>CacheIgnoreCacheControl On|Off</syntax>
15f37a157fbbf107658ed82ec30c348a9b6e518end<default>CacheIgnoreCacheControl Off</default>
15f37a157fbbf107658ed82ec30c348a9b6e518end<contextlist><context>server config</context><context>virtual host</context>
15f37a157fbbf107658ed82ec30c348a9b6e518end</contextlist>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard<usage>
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz <p>Ordinarily, requests containing a Cache-Control: no-cache or
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz Pragma: no-cache header value will not be served from the cache. The
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz <directive>CacheIgnoreCacheControl</directive> directive allows this
589775a2f132eef1881f348ecdb969fb709d7ddbpctony behavior to be overridden. <directive>CacheIgnoreCacheControl On</directive>
589775a2f132eef1881f348ecdb969fb709d7ddbpctony tells the server to attempt to serve the resource from the cache even
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz if the request contains no-cache header values. Resources requiring
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz authorization will <em>never</em> be cached.</p>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard <example>
15f37a157fbbf107658ed82ec30c348a9b6e518end CacheIgnoreCacheControl On
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard </example>
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz <note type="warning"><title>Warning:</title>
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz This directive will allow serving from the cache even if the client has
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz requested that the document not be served from the cache. This might
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz result in stale content being served.
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz </note>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard</usage>
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz<seealso><directive module="mod_cache">CacheStorePrivate</directive></seealso>
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz<seealso><directive module="mod_cache">CacheStoreNoStore</directive></seealso>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard</directivesynopsis>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard
fc3182e72cf0679cbf14a95213fbb9a98c3cf597rpluem<directivesynopsis>
fc3182e72cf0679cbf14a95213fbb9a98c3cf597rpluem<name>CacheIgnoreQueryString</name>
fc3182e72cf0679cbf14a95213fbb9a98c3cf597rpluem<description>Ignore query string when caching</description>
fc3182e72cf0679cbf14a95213fbb9a98c3cf597rpluem<syntax>CacheIgnoreQueryString On|Off</syntax>
fc3182e72cf0679cbf14a95213fbb9a98c3cf597rpluem<default>CacheIgnoreQueryString Off</default>
fc3182e72cf0679cbf14a95213fbb9a98c3cf597rpluem<contextlist><context>server config</context><context>virtual host</context>
fc3182e72cf0679cbf14a95213fbb9a98c3cf597rpluem</contextlist>
fc3182e72cf0679cbf14a95213fbb9a98c3cf597rpluem
fc3182e72cf0679cbf14a95213fbb9a98c3cf597rpluem<usage>
fc3182e72cf0679cbf14a95213fbb9a98c3cf597rpluem <p>Ordinarily, requests with query string parameters are cached separately
fc3182e72cf0679cbf14a95213fbb9a98c3cf597rpluem for each unique query string. This is according to RFC 2616/13.9 done only
860b4efe27e7c1c9a2bf5c872b29c90f76849b51jim if an expiration time is specified. The
fc3182e72cf0679cbf14a95213fbb9a98c3cf597rpluem <directive>CacheIgnoreQueryString</directive> directive tells the cache to
860b4efe27e7c1c9a2bf5c872b29c90f76849b51jim cache requests even if no expiration time is specified, and to reply with
fc3182e72cf0679cbf14a95213fbb9a98c3cf597rpluem a cached reply even if the query string differs. From a caching point of
860b4efe27e7c1c9a2bf5c872b29c90f76849b51jim view the request is treated as if having no query string when this
fc3182e72cf0679cbf14a95213fbb9a98c3cf597rpluem directive is enabled.</p>
fc3182e72cf0679cbf14a95213fbb9a98c3cf597rpluem
fc3182e72cf0679cbf14a95213fbb9a98c3cf597rpluem <example>
fc3182e72cf0679cbf14a95213fbb9a98c3cf597rpluem CacheIgnoreQueryString On
fc3182e72cf0679cbf14a95213fbb9a98c3cf597rpluem </example>
fc3182e72cf0679cbf14a95213fbb9a98c3cf597rpluem
fc3182e72cf0679cbf14a95213fbb9a98c3cf597rpluem</usage>
fc3182e72cf0679cbf14a95213fbb9a98c3cf597rpluem</directivesynopsis>
fc3182e72cf0679cbf14a95213fbb9a98c3cf597rpluem
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard<directivesynopsis>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard<name>CacheLastModifiedFactor</name>
62e52789bfc10a5fd0a433af77e77c8ebbbed6c2rederpj<description>The factor used to compute an expiry date based on the
62e52789bfc10a5fd0a433af77e77c8ebbbed6c2rederpjLastModified date.</description>
15f37a157fbbf107658ed82ec30c348a9b6e518end<syntax>CacheLastModifiedFactor <var>float</var></syntax>
1e5b300cc68389a18fe3762b1b980b0c86712ba1stoddard<default>CacheLastModifiedFactor 0.1</default>
4cefc38158672f5de8119886d9754cf0609a9371minfrin<contextlist><context>server config</context>
4cefc38158672f5de8119886d9754cf0609a9371minfrin <context>virtual host</context>
4cefc38158672f5de8119886d9754cf0609a9371minfrin <context>directory</context>
4cefc38158672f5de8119886d9754cf0609a9371minfrin <context>.htaccess</context>
15f37a157fbbf107658ed82ec30c348a9b6e518end</contextlist>
860b4efe27e7c1c9a2bf5c872b29c90f76849b51jim
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard<usage>
62e52789bfc10a5fd0a433af77e77c8ebbbed6c2rederpj <p>In the event that a document does not provide an expiry date but does
62e52789bfc10a5fd0a433af77e77c8ebbbed6c2rederpj provide a last-modified date, an expiry date can be calculated based on
62e52789bfc10a5fd0a433af77e77c8ebbbed6c2rederpj the time since the document was last modified. The
62e52789bfc10a5fd0a433af77e77c8ebbbed6c2rederpj <directive>CacheLastModifiedFactor</directive> directive specifies a
62e52789bfc10a5fd0a433af77e77c8ebbbed6c2rederpj <var>factor</var> to be used in the generation of this expiry date
62e52789bfc10a5fd0a433af77e77c8ebbbed6c2rederpj according to the following formula:
62e52789bfc10a5fd0a433af77e77c8ebbbed6c2rederpj
62e52789bfc10a5fd0a433af77e77c8ebbbed6c2rederpj <code>expiry-period = time-since-last-modified-date * <var>factor</var>
62e52789bfc10a5fd0a433af77e77c8ebbbed6c2rederpj expiry-date = current-date + expiry-period</code>
62e52789bfc10a5fd0a433af77e77c8ebbbed6c2rederpj
62e52789bfc10a5fd0a433af77e77c8ebbbed6c2rederpj For example, if the document was last modified 10 hours ago, and
62e52789bfc10a5fd0a433af77e77c8ebbbed6c2rederpj <var>factor</var> is 0.1 then the expiry-period will be set to
62e52789bfc10a5fd0a433af77e77c8ebbbed6c2rederpj 10*0.1 = 1 hour. If the current time was 3:00pm then the computed
62e52789bfc10a5fd0a433af77e77c8ebbbed6c2rederpj expiry-date would be 3:00pm + 1hour = 4:00pm.
62e52789bfc10a5fd0a433af77e77c8ebbbed6c2rederpj
62e52789bfc10a5fd0a433af77e77c8ebbbed6c2rederpj If the expiry-period would be longer than that set by
62e52789bfc10a5fd0a433af77e77c8ebbbed6c2rederpj <directive>CacheMaxExpire</directive>, then the latter takes
62e52789bfc10a5fd0a433af77e77c8ebbbed6c2rederpj precedence.</p>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard <example>
15f37a157fbbf107658ed82ec30c348a9b6e518end CacheLastModifiedFactor 0.5
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard </example>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard</usage>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard</directivesynopsis>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard
1e5b300cc68389a18fe3762b1b980b0c86712ba1stoddard<directivesynopsis>
a80dd6ffd7a1484e7f45e4665689bdd84fc97153jerenkrantz<name>CacheIgnoreHeaders</name>
a80dd6ffd7a1484e7f45e4665689bdd84fc97153jerenkrantz<description>Do not store the given HTTP header(s) in the cache.
a80dd6ffd7a1484e7f45e4665689bdd84fc97153jerenkrantz</description>
a80dd6ffd7a1484e7f45e4665689bdd84fc97153jerenkrantz<syntax>CacheIgnoreHeaders <var>header-string</var> [<var>header-string</var>] ...</syntax>
a80dd6ffd7a1484e7f45e4665689bdd84fc97153jerenkrantz<default>CacheIgnoreHeaders None</default>
a80dd6ffd7a1484e7f45e4665689bdd84fc97153jerenkrantz<contextlist><context>server config</context><context>virtual host</context>
a80dd6ffd7a1484e7f45e4665689bdd84fc97153jerenkrantz</contextlist>
a80dd6ffd7a1484e7f45e4665689bdd84fc97153jerenkrantz
a80dd6ffd7a1484e7f45e4665689bdd84fc97153jerenkrantz<usage>
a80dd6ffd7a1484e7f45e4665689bdd84fc97153jerenkrantz <p>According to RFC 2616, hop-by-hop HTTP headers are not stored in
a80dd6ffd7a1484e7f45e4665689bdd84fc97153jerenkrantz the cache. The following HTTP headers are hop-by-hop headers and thus
a80dd6ffd7a1484e7f45e4665689bdd84fc97153jerenkrantz do not get stored in the cache in <em>any</em> case regardless of the
a80dd6ffd7a1484e7f45e4665689bdd84fc97153jerenkrantz setting of <directive>CacheIgnoreHeaders</directive>:</p>
a80dd6ffd7a1484e7f45e4665689bdd84fc97153jerenkrantz
a80dd6ffd7a1484e7f45e4665689bdd84fc97153jerenkrantz <ul>
a80dd6ffd7a1484e7f45e4665689bdd84fc97153jerenkrantz <li><code>Connection</code></li>
a80dd6ffd7a1484e7f45e4665689bdd84fc97153jerenkrantz <li><code>Keep-Alive</code></li>
a80dd6ffd7a1484e7f45e4665689bdd84fc97153jerenkrantz <li><code>Proxy-Authenticate</code></li>
a80dd6ffd7a1484e7f45e4665689bdd84fc97153jerenkrantz <li><code>Proxy-Authorization</code></li>
a80dd6ffd7a1484e7f45e4665689bdd84fc97153jerenkrantz <li><code>TE</code></li>
a80dd6ffd7a1484e7f45e4665689bdd84fc97153jerenkrantz <li><code>Trailers</code></li>
a80dd6ffd7a1484e7f45e4665689bdd84fc97153jerenkrantz <li><code>Transfer-Encoding</code></li>
a80dd6ffd7a1484e7f45e4665689bdd84fc97153jerenkrantz <li><code>Upgrade</code></li>
a80dd6ffd7a1484e7f45e4665689bdd84fc97153jerenkrantz </ul>
a80dd6ffd7a1484e7f45e4665689bdd84fc97153jerenkrantz
a80dd6ffd7a1484e7f45e4665689bdd84fc97153jerenkrantz <p><directive>CacheIgnoreHeaders</directive> specifies additional HTTP
a80dd6ffd7a1484e7f45e4665689bdd84fc97153jerenkrantz headers that should not to be stored in the cache. For example, it makes
a80dd6ffd7a1484e7f45e4665689bdd84fc97153jerenkrantz sense in some cases to prevent cookies from being stored in the cache.</p>
a80dd6ffd7a1484e7f45e4665689bdd84fc97153jerenkrantz
a80dd6ffd7a1484e7f45e4665689bdd84fc97153jerenkrantz <p><directive>CacheIgnoreHeaders</directive> takes a space separated list
a80dd6ffd7a1484e7f45e4665689bdd84fc97153jerenkrantz of HTTP headers that should not be stored in the cache. If only hop-by-hop
a80dd6ffd7a1484e7f45e4665689bdd84fc97153jerenkrantz headers not should be stored in the cache (the RFC 2616 compliant
a80dd6ffd7a1484e7f45e4665689bdd84fc97153jerenkrantz behaviour), <directive>CacheIgnoreHeaders</directive> can be set to
a80dd6ffd7a1484e7f45e4665689bdd84fc97153jerenkrantz <code>None</code>.</p>
a80dd6ffd7a1484e7f45e4665689bdd84fc97153jerenkrantz
a80dd6ffd7a1484e7f45e4665689bdd84fc97153jerenkrantz <example><title>Example 1</title>
a80dd6ffd7a1484e7f45e4665689bdd84fc97153jerenkrantz CacheIgnoreHeaders Set-Cookie
a80dd6ffd7a1484e7f45e4665689bdd84fc97153jerenkrantz </example>
a80dd6ffd7a1484e7f45e4665689bdd84fc97153jerenkrantz
a80dd6ffd7a1484e7f45e4665689bdd84fc97153jerenkrantz <example><title>Example 2</title>
a80dd6ffd7a1484e7f45e4665689bdd84fc97153jerenkrantz CacheIgnoreHeaders None
a80dd6ffd7a1484e7f45e4665689bdd84fc97153jerenkrantz </example>
a80dd6ffd7a1484e7f45e4665689bdd84fc97153jerenkrantz
a80dd6ffd7a1484e7f45e4665689bdd84fc97153jerenkrantz <note type="warning"><title>Warning:</title>
a80dd6ffd7a1484e7f45e4665689bdd84fc97153jerenkrantz If headers like <code>Expires</code> which are needed for proper cache
a80dd6ffd7a1484e7f45e4665689bdd84fc97153jerenkrantz management are not stored due to a
a80dd6ffd7a1484e7f45e4665689bdd84fc97153jerenkrantz <directive>CacheIgnoreHeaders</directive> setting, the behaviour of
a80dd6ffd7a1484e7f45e4665689bdd84fc97153jerenkrantz mod_cache is undefined.
a80dd6ffd7a1484e7f45e4665689bdd84fc97153jerenkrantz </note>
a80dd6ffd7a1484e7f45e4665689bdd84fc97153jerenkrantz</usage>
a80dd6ffd7a1484e7f45e4665689bdd84fc97153jerenkrantz</directivesynopsis>
a80dd6ffd7a1484e7f45e4665689bdd84fc97153jerenkrantz
186e9d990f453d16826ab87a87df7b87e6e05921rpluem<directivesynopsis>
186e9d990f453d16826ab87a87df7b87e6e05921rpluem<name>CacheIgnoreURLSessionIdentifiers</name>
186e9d990f453d16826ab87a87df7b87e6e05921rpluem<description>Ignore defined session identifiers encoded in the URL when caching
186e9d990f453d16826ab87a87df7b87e6e05921rpluem</description>
186e9d990f453d16826ab87a87df7b87e6e05921rpluem<syntax>CacheIgnoreURLSessionIdentifiers <var>identifier</var> [<var>identifier</var>] ...</syntax>
186e9d990f453d16826ab87a87df7b87e6e05921rpluem<default>CacheIgnoreURLSessionIdentifiers None</default>
186e9d990f453d16826ab87a87df7b87e6e05921rpluem<contextlist><context>server config</context><context>virtual host</context>
186e9d990f453d16826ab87a87df7b87e6e05921rpluem</contextlist>
186e9d990f453d16826ab87a87df7b87e6e05921rpluem
186e9d990f453d16826ab87a87df7b87e6e05921rpluem<usage>
186e9d990f453d16826ab87a87df7b87e6e05921rpluem <p>Sometimes applications encode the session identifier into the URL like in the following
186e9d990f453d16826ab87a87df7b87e6e05921rpluem Examples:
186e9d990f453d16826ab87a87df7b87e6e05921rpluem </p>
186e9d990f453d16826ab87a87df7b87e6e05921rpluem <ul>
186e9d990f453d16826ab87a87df7b87e6e05921rpluem <li><code>/someapplication/image.gif;jsessionid=123456789</code></li>
186e9d990f453d16826ab87a87df7b87e6e05921rpluem <li><code>/someapplication/image.gif?PHPSESSIONID=12345678</code></li>
186e9d990f453d16826ab87a87df7b87e6e05921rpluem </ul>
186e9d990f453d16826ab87a87df7b87e6e05921rpluem <p>This causes cachable resources to be stored separately for each session, which
186e9d990f453d16826ab87a87df7b87e6e05921rpluem is often not desired. <directive>CacheIgnoreURLSessionIdentifiers</directive> lets
186e9d990f453d16826ab87a87df7b87e6e05921rpluem define a list of identifiers that are removed from the key that is used to identify
186e9d990f453d16826ab87a87df7b87e6e05921rpluem an entity in the cache, such that cachable resources are not stored separately for
186e9d990f453d16826ab87a87df7b87e6e05921rpluem each session.
186e9d990f453d16826ab87a87df7b87e6e05921rpluem </p>
65ada7c754866f293fce01f3e6278122b4c44848rpluem <p><code>CacheIgnoreURLSessionIdentifiers None</code> clears the list of ignored
65ada7c754866f293fce01f3e6278122b4c44848rpluem identifiers. Otherwise, each identifier is added to the list.</p>
186e9d990f453d16826ab87a87df7b87e6e05921rpluem
186e9d990f453d16826ab87a87df7b87e6e05921rpluem <example><title>Example 1</title>
186e9d990f453d16826ab87a87df7b87e6e05921rpluem CacheIgnoreURLSessionIdentifiers jsessionid
186e9d990f453d16826ab87a87df7b87e6e05921rpluem </example>
186e9d990f453d16826ab87a87df7b87e6e05921rpluem
186e9d990f453d16826ab87a87df7b87e6e05921rpluem <example><title>Example 2</title>
186e9d990f453d16826ab87a87df7b87e6e05921rpluem CacheIgnoreURLSessionIdentifiers None
186e9d990f453d16826ab87a87df7b87e6e05921rpluem </example>
186e9d990f453d16826ab87a87df7b87e6e05921rpluem
186e9d990f453d16826ab87a87df7b87e6e05921rpluem</usage>
186e9d990f453d16826ab87a87df7b87e6e05921rpluem</directivesynopsis>
186e9d990f453d16826ab87a87df7b87e6e05921rpluem
1fe05d56d6757d4b5d30b8a199f32417cc396f25wrowe<directivesynopsis>
1fe05d56d6757d4b5d30b8a199f32417cc396f25wrowe<name>CacheStoreExpired</name>
1fe05d56d6757d4b5d30b8a199f32417cc396f25wrowe<description>Attempt to cache responses that the server reports as expired</description>
1fe05d56d6757d4b5d30b8a199f32417cc396f25wrowe<syntax>CacheStoreExpired On|Off</syntax>
1fe05d56d6757d4b5d30b8a199f32417cc396f25wrowe<default>CacheStoreExpired Off</default>
4cefc38158672f5de8119886d9754cf0609a9371minfrin<contextlist><context>server config</context>
4cefc38158672f5de8119886d9754cf0609a9371minfrin <context>virtual host</context>
4cefc38158672f5de8119886d9754cf0609a9371minfrin <context>directory</context>
4cefc38158672f5de8119886d9754cf0609a9371minfrin <context>.htaccess</context>
1fe05d56d6757d4b5d30b8a199f32417cc396f25wrowe</contextlist>
1fe05d56d6757d4b5d30b8a199f32417cc396f25wrowe
1fe05d56d6757d4b5d30b8a199f32417cc396f25wrowe<usage>
f806f14aeef29d152de9261603ace06437f1c4cfwrowe <p>Since httpd 2.2.4, responses which have already expired are not
1fe05d56d6757d4b5d30b8a199f32417cc396f25wrowe stored in the cache. The <directive>CacheStoreExpired</directive>
1fe05d56d6757d4b5d30b8a199f32417cc396f25wrowe directive allows this behavior to be overridden.
1fe05d56d6757d4b5d30b8a199f32417cc396f25wrowe <directive>CacheStoreExpired</directive> On
1fe05d56d6757d4b5d30b8a199f32417cc396f25wrowe tells the server to attempt to cache the resource if it is stale.
1fe05d56d6757d4b5d30b8a199f32417cc396f25wrowe Subsequent requests would trigger an If-Modified-Since request of
1fe05d56d6757d4b5d30b8a199f32417cc396f25wrowe the origin server, and the response may be fulfilled from cache
1fe05d56d6757d4b5d30b8a199f32417cc396f25wrowe if the backend resource has not changed.</p>
1fe05d56d6757d4b5d30b8a199f32417cc396f25wrowe
1fe05d56d6757d4b5d30b8a199f32417cc396f25wrowe <example>
1fe05d56d6757d4b5d30b8a199f32417cc396f25wrowe CacheStoreExpired On
1fe05d56d6757d4b5d30b8a199f32417cc396f25wrowe </example>
1fe05d56d6757d4b5d30b8a199f32417cc396f25wrowe</usage>
1fe05d56d6757d4b5d30b8a199f32417cc396f25wrowe</directivesynopsis>
1fe05d56d6757d4b5d30b8a199f32417cc396f25wrowe
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz<directivesynopsis>
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz<name>CacheStorePrivate</name>
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz<description>Attempt to cache responses that the server has marked as private</description>
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz<syntax>CacheStorePrivate On|Off</syntax>
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz<default>CacheStorePrivate Off</default>
4cefc38158672f5de8119886d9754cf0609a9371minfrin<contextlist><context>server config</context>
4cefc38158672f5de8119886d9754cf0609a9371minfrin <context>virtual host</context>
4cefc38158672f5de8119886d9754cf0609a9371minfrin <context>directory</context>
4cefc38158672f5de8119886d9754cf0609a9371minfrin <context>.htaccess</context>
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz</contextlist>
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz<usage>
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz <p>Ordinarily, responses with Cache-Control: private header values will not
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz be stored in the cache. The <directive>CacheStorePrivate</directive>
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz directive allows this behavior to be overridden.
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz <directive>CacheStorePrivate</directive> On
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz tells the server to attempt to cache the resource even if it contains
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz private header values. Resources requiring authorization will
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz <em>never</em> be cached.</p>
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz <example>
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz CacheStorePrivate On
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz </example>
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz <note type="warning"><title>Warning:</title>
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz This directive will allow caching even if the upstream server has
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz requested that the resource not be cached. This directive is only
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz ideal for a 'private' cache.
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz </note>
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz</usage>
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz<seealso><directive module="mod_cache">CacheIgnoreCacheControl</directive></seealso>
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz<seealso><directive module="mod_cache">CacheStoreNoStore</directive></seealso>
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz</directivesynopsis>
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz<directivesynopsis>
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz<name>CacheStoreNoStore</name>
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz<description>Attempt to cache requests or responses that have been marked as no-store.</description>
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz<syntax>CacheStoreNoStore On|Off</syntax>
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz<default>CacheStoreNoStore Off</default>
4cefc38158672f5de8119886d9754cf0609a9371minfrin<contextlist><context>server config</context>
4cefc38158672f5de8119886d9754cf0609a9371minfrin <context>virtual host</context>
4cefc38158672f5de8119886d9754cf0609a9371minfrin <context>directory</context>
4cefc38158672f5de8119886d9754cf0609a9371minfrin <context>.htaccess</context>
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz</contextlist>
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz<usage>
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz <p>Ordinarily, requests or responses with Cache-Control: no-store header
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz values will not be stored in the cache. The
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz <directive>CacheStoreNoCache</directive> directive allows this
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz behavior to be overridden. <directive>CacheStoreNoCache</directive> On
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz tells the server to attempt to cache the resource even if it contains
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz no-store header values. Resources requiring authorization will
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz <em>never</em> be cached.</p>
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz <example>
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz CacheStoreNoStore On
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz </example>
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz <note type="warning"><title>Warning:</title>
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz As described in RFC 2616, the no-store directive is intended to
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz "prevent the inadvertent release or retention of sensitive information
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz (for example, on backup tapes)." Enabling this option could store
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz sensitive information in the cache. You are hereby warned.
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz </note>
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz</usage>
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz<seealso><directive module="mod_cache">CacheIgnoreCacheControl</directive></seealso>
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz<seealso><directive module="mod_cache">CacheStorePrivate</directive></seealso>
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz</directivesynopsis>
3c67b7956d44501360506a9f13a5011be73b30ecminfrin
3c67b7956d44501360506a9f13a5011be73b30ecminfrin<directivesynopsis>
3c67b7956d44501360506a9f13a5011be73b30ecminfrin<name>CacheLock</name>
3c67b7956d44501360506a9f13a5011be73b30ecminfrin<description>Enable the thundering herd lock.</description>
3c67b7956d44501360506a9f13a5011be73b30ecminfrin<syntax>CacheLock <var>on|off</var></syntax>
3c67b7956d44501360506a9f13a5011be73b30ecminfrin<default>CacheLock off</default>
3c67b7956d44501360506a9f13a5011be73b30ecminfrin<contextlist><context>server config</context><context>virtual host</context>
3c67b7956d44501360506a9f13a5011be73b30ecminfrin</contextlist>
e4926c84e8383fedec4590596a29efae1933341dtrawick<compatibility>Available in Apache 2.2.15 and later</compatibility>
3c67b7956d44501360506a9f13a5011be73b30ecminfrin
3c67b7956d44501360506a9f13a5011be73b30ecminfrin<usage>
3c67b7956d44501360506a9f13a5011be73b30ecminfrin <p>The <directive>CacheLock</directive> directive enables the thundering herd lock
3c67b7956d44501360506a9f13a5011be73b30ecminfrin for the given URL space.</p>
860b4efe27e7c1c9a2bf5c872b29c90f76849b51jim
3c67b7956d44501360506a9f13a5011be73b30ecminfrin <p>In a minimal configuration the following directive is all that is needed to
3c67b7956d44501360506a9f13a5011be73b30ecminfrin enable the thundering herd lock in the default system temp directory.</p>
3c67b7956d44501360506a9f13a5011be73b30ecminfrin
3c67b7956d44501360506a9f13a5011be73b30ecminfrin <example>
03fc700cc2a7b22b84891f9595f23e40d5243b62lgentis # Enable cache lock<br />
3c67b7956d44501360506a9f13a5011be73b30ecminfrin CacheLock on<br /><br />
3c67b7956d44501360506a9f13a5011be73b30ecminfrin </example>
3c67b7956d44501360506a9f13a5011be73b30ecminfrin
3c67b7956d44501360506a9f13a5011be73b30ecminfrin</usage>
3c67b7956d44501360506a9f13a5011be73b30ecminfrin</directivesynopsis>
3c67b7956d44501360506a9f13a5011be73b30ecminfrin
3c67b7956d44501360506a9f13a5011be73b30ecminfrin<directivesynopsis>
3c67b7956d44501360506a9f13a5011be73b30ecminfrin<name>CacheLockPath</name>
3c67b7956d44501360506a9f13a5011be73b30ecminfrin<description>Set the lock path directory.</description>
3c67b7956d44501360506a9f13a5011be73b30ecminfrin<syntax>CacheLockPath <var>directory</var></syntax>
3c67b7956d44501360506a9f13a5011be73b30ecminfrin<default>CacheLockPath /tmp/mod_cache-lock</default>
3c67b7956d44501360506a9f13a5011be73b30ecminfrin<contextlist><context>server config</context><context>virtual host</context>
3c67b7956d44501360506a9f13a5011be73b30ecminfrin</contextlist>
860b4efe27e7c1c9a2bf5c872b29c90f76849b51jim
3c67b7956d44501360506a9f13a5011be73b30ecminfrin<usage>
3c67b7956d44501360506a9f13a5011be73b30ecminfrin <p>The <directive>CacheLockPath</directive> directive allows you to specify the
3c67b7956d44501360506a9f13a5011be73b30ecminfrin directory in which the locks are created. By default, the system's temporary
3c67b7956d44501360506a9f13a5011be73b30ecminfrin folder is used. Locks consist of empty files that only exist for stale URLs
3c67b7956d44501360506a9f13a5011be73b30ecminfrin in flight, so is significantly less resource intensive than the traditional
3c67b7956d44501360506a9f13a5011be73b30ecminfrin disk cache.</p>
3c67b7956d44501360506a9f13a5011be73b30ecminfrin
3c67b7956d44501360506a9f13a5011be73b30ecminfrin</usage>
3c67b7956d44501360506a9f13a5011be73b30ecminfrin</directivesynopsis>
7b467aa53854c95318a1c709709c1619a4f47118minfrin
3c67b7956d44501360506a9f13a5011be73b30ecminfrin<directivesynopsis>
3c67b7956d44501360506a9f13a5011be73b30ecminfrin<name>CacheLockMaxAge</name>
3c67b7956d44501360506a9f13a5011be73b30ecminfrin<description>Set the maximum possible age of a cache lock.</description>
3c67b7956d44501360506a9f13a5011be73b30ecminfrin<syntax>CacheLockMaxAge <var>integer</var></syntax>
3c67b7956d44501360506a9f13a5011be73b30ecminfrin<default>CacheLockMaxAge 5</default>
3c67b7956d44501360506a9f13a5011be73b30ecminfrin<contextlist><context>server config</context><context>virtual host</context>
3c67b7956d44501360506a9f13a5011be73b30ecminfrin</contextlist>
860b4efe27e7c1c9a2bf5c872b29c90f76849b51jim
3c67b7956d44501360506a9f13a5011be73b30ecminfrin<usage>
3c67b7956d44501360506a9f13a5011be73b30ecminfrin <p>The <directive>CacheLockMaxAge</directive> directive specifies the maximum
3c67b7956d44501360506a9f13a5011be73b30ecminfrin age of any cache lock.</p>
860b4efe27e7c1c9a2bf5c872b29c90f76849b51jim
3c67b7956d44501360506a9f13a5011be73b30ecminfrin <p>A lock older than this value in seconds will be ignored, and the next
3c67b7956d44501360506a9f13a5011be73b30ecminfrin incoming request will be given the opportunity to re-establish the lock.
3c67b7956d44501360506a9f13a5011be73b30ecminfrin This mechanism prevents a slow client taking an excessively long time to refresh
3c67b7956d44501360506a9f13a5011be73b30ecminfrin an entity.</p>
860b4efe27e7c1c9a2bf5c872b29c90f76849b51jim
3c67b7956d44501360506a9f13a5011be73b30ecminfrin</usage>
3c67b7956d44501360506a9f13a5011be73b30ecminfrin</directivesynopsis>
7b467aa53854c95318a1c709709c1619a4f47118minfrin
7b467aa53854c95318a1c709709c1619a4f47118minfrin<directivesynopsis>
7b467aa53854c95318a1c709709c1619a4f47118minfrin <name>CacheQuickHandler</name>
7b467aa53854c95318a1c709709c1619a4f47118minfrin <description>Run the cache from the quick handler.</description>
7b467aa53854c95318a1c709709c1619a4f47118minfrin <syntax>CacheQuickHandler <var>on|off</var></syntax>
7b467aa53854c95318a1c709709c1619a4f47118minfrin <default>CacheQuickHandler on</default>
7b467aa53854c95318a1c709709c1619a4f47118minfrin <contextlist><context>server config</context><context>virtual host</context>
7b467aa53854c95318a1c709709c1619a4f47118minfrin </contextlist>
0e7b9978df6fac23db4330b09e890cf6de6ff7b6covener <compatibility>Apache HTTP Server 2.3.3 and later</compatibility>
7b467aa53854c95318a1c709709c1619a4f47118minfrin
7b467aa53854c95318a1c709709c1619a4f47118minfrin <usage>
7b467aa53854c95318a1c709709c1619a4f47118minfrin <p>The <directive module="mod_cache">CacheQuickHandler</directive> directive
7b467aa53854c95318a1c709709c1619a4f47118minfrin controls the phase in which the cache is handled.</p>
7b467aa53854c95318a1c709709c1619a4f47118minfrin
7b467aa53854c95318a1c709709c1619a4f47118minfrin <p>In the default enabled configuration, the cache operates within the quick
7b467aa53854c95318a1c709709c1619a4f47118minfrin handler phase. This phase short circuits the majority of server processing,
7b467aa53854c95318a1c709709c1619a4f47118minfrin and represents the most performant mode of operation for a typical server.
7b467aa53854c95318a1c709709c1619a4f47118minfrin The cache <strong>bolts onto</strong> the front of the server, and the
7b467aa53854c95318a1c709709c1619a4f47118minfrin majority of server processing is avoided.</p>
7b467aa53854c95318a1c709709c1619a4f47118minfrin
7b467aa53854c95318a1c709709c1619a4f47118minfrin <p>When disabled, the cache operates as a normal handler, and is subject to
7b467aa53854c95318a1c709709c1619a4f47118minfrin the full set of phases when handling a server request. While this mode is
7b467aa53854c95318a1c709709c1619a4f47118minfrin slower than the default, it allows the cache to be used in cases where full
7b467aa53854c95318a1c709709c1619a4f47118minfrin processing is required, such as when content is subject to authorisation.</p>
7b467aa53854c95318a1c709709c1619a4f47118minfrin
7b467aa53854c95318a1c709709c1619a4f47118minfrin <example>
7b467aa53854c95318a1c709709c1619a4f47118minfrin # Run cache as a normal handler<br />
7b467aa53854c95318a1c709709c1619a4f47118minfrin CacheQuickHandler off<br /><br />
7b467aa53854c95318a1c709709c1619a4f47118minfrin </example>
7b467aa53854c95318a1c709709c1619a4f47118minfrin
7b467aa53854c95318a1c709709c1619a4f47118minfrin <p>It is also possible, when the quick handler is disabled, for the
7b467aa53854c95318a1c709709c1619a4f47118minfrin administrator to choose the precise location within the filter chain where
7b467aa53854c95318a1c709709c1619a4f47118minfrin caching is to be performed, by adding the <strong>CACHE</strong> filter to
7b467aa53854c95318a1c709709c1619a4f47118minfrin the chain.</p>
7b467aa53854c95318a1c709709c1619a4f47118minfrin
7b467aa53854c95318a1c709709c1619a4f47118minfrin <example>
7b467aa53854c95318a1c709709c1619a4f47118minfrin # Cache content before mod_include and mod_deflate<br />
7b467aa53854c95318a1c709709c1619a4f47118minfrin CacheQuickHandler off<br />
7b467aa53854c95318a1c709709c1619a4f47118minfrin AddOutputFilterByType CACHE;INCLUDES;DEFLATE text/html<br /><br />
7b467aa53854c95318a1c709709c1619a4f47118minfrin </example>
7b467aa53854c95318a1c709709c1619a4f47118minfrin
7b467aa53854c95318a1c709709c1619a4f47118minfrin <p>If the CACHE filter is specified more than once, the last instance will
7b467aa53854c95318a1c709709c1619a4f47118minfrin apply.</p>
7b467aa53854c95318a1c709709c1619a4f47118minfrin
7b467aa53854c95318a1c709709c1619a4f47118minfrin </usage>
7b467aa53854c95318a1c709709c1619a4f47118minfrin</directivesynopsis>
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin<directivesynopsis>
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin<name>CacheHeader</name>
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin<description>Add an X-Cache header to the response.</description>
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin<syntax>CacheHeader <var>on|off</var></syntax>
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin<default>CacheHeader off</default>
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin<contextlist><context>server config</context>
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin <context>virtual host</context>
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin <context>directory</context>
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin <context>.htaccess</context>
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin</contextlist>
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin<compatibility>Available in Apache 2.3.9 and later</compatibility>
860b4efe27e7c1c9a2bf5c872b29c90f76849b51jim
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin<usage>
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin <p>When the <directive module="mod_cache">CacheHeader</directive> directive
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin is switched on, an <strong>X-Cache</strong> header will be added to the response
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin with the cache status of this response. If the normal handler is used, this
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin directive may appear within a <directive module="core">&lt;Directory&gt;</directive>
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin or <directive module="core">&lt;Location&gt;</directive> directive. If the quick
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin handler is used, this directive must appear within a server or virtual host
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin context, otherwise the setting will be ignored.</p>
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin <dl>
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin <dt><strong>HIT</strong></dt><dd>The entity was fresh, and was served from
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin cache.</dd>
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin <dt><strong>REVALIDATE</strong></dt><dd>The entity was stale, was successfully
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin revalidated and was served from cache.</dd>
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin <dt><strong>MISS</strong></dt><dd>The entity was fetched from the upstream
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin server and was not served from cache.</dd>
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin </dl>
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin <example>
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin # Enable the X-Cache header<br />
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin CacheHeader on<br />
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin </example>
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin <example>
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin X-Cache: HIT from localhost<br />
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin </example>
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin</usage>
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin</directivesynopsis>
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin<directivesynopsis>
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin<name>CacheDetailHeader</name>
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin<description>Add an X-Cache-Detail header to the response.</description>
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin<syntax>CacheDetailHeader <var>on|off</var></syntax>
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin<default>CacheDetailHeader off</default>
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin<contextlist><context>server config</context>
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin <context>virtual host</context>
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin <context>directory</context>
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin <context>.htaccess</context>
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin</contextlist>
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin<compatibility>Available in Apache 2.3.9 and later</compatibility>
860b4efe27e7c1c9a2bf5c872b29c90f76849b51jim
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin<usage>
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin <p>When the <directive module="mod_cache">CacheDetailHeader</directive> directive
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin is switched on, an <strong>X-Cache-Detail</strong> header will be added to the response
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin containing the detailed reason for a particular caching decision.</p>
860b4efe27e7c1c9a2bf5c872b29c90f76849b51jim
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin <p>It can be useful during development of cached RESTful services to have additional
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin information about the caching decision written to the response headers, so as to
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin confirm whether <code>Cache-Control</code> and other headers have been correctly
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin used by the service and client.</p>
860b4efe27e7c1c9a2bf5c872b29c90f76849b51jim
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin <p>If the normal handler is used, this directive may appear within a
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin <directive module="core">&lt;Directory&gt;</directive> or
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin <directive module="core">&lt;Location&gt;</directive> directive. If the quick handler
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin is used, this directive must appear within a server or virtual host context, otherwise
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin the setting will be ignored.</p>
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin <example>
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin # Enable the X-Cache-Detail header<br />
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin CacheDetailHeader on<br />
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin </example>
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin <example>
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin X-Cache-Detail: "conditional cache hit: entity refreshed" from localhost<br />
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin </example>
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin</usage>
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin</directivesynopsis>
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin
4aef34911af88f96c5b6d9b71a550a5a97bbc0b6minfrin<directivesynopsis>
4aef34911af88f96c5b6d9b71a550a5a97bbc0b6minfrin<name>CacheKeyBaseURL</name>
4aef34911af88f96c5b6d9b71a550a5a97bbc0b6minfrin<description>Override the base URL of reverse proxied cache keys.</description>
4aef34911af88f96c5b6d9b71a550a5a97bbc0b6minfrin<syntax>CacheKeyBaseURL <var>URL</var></syntax>
4aef34911af88f96c5b6d9b71a550a5a97bbc0b6minfrin<default>CacheKeyBaseURL http://example.com</default>
4aef34911af88f96c5b6d9b71a550a5a97bbc0b6minfrin<contextlist><context>server config</context>
4aef34911af88f96c5b6d9b71a550a5a97bbc0b6minfrin<context>virtual host</context>
4aef34911af88f96c5b6d9b71a550a5a97bbc0b6minfrin</contextlist>
4aef34911af88f96c5b6d9b71a550a5a97bbc0b6minfrin<compatibility>Available in Apache 2.3.9 and later</compatibility>
4aef34911af88f96c5b6d9b71a550a5a97bbc0b6minfrin
4aef34911af88f96c5b6d9b71a550a5a97bbc0b6minfrin<usage>
4aef34911af88f96c5b6d9b71a550a5a97bbc0b6minfrin <p>When the <directive module="mod_cache">CacheKeyBaseURL</directive> directive
4aef34911af88f96c5b6d9b71a550a5a97bbc0b6minfrin is specified, the URL provided will be used as the base URL to calculate
4aef34911af88f96c5b6d9b71a550a5a97bbc0b6minfrin the URL of the cache keys in the reverse proxy configuration. When not specified,
4aef34911af88f96c5b6d9b71a550a5a97bbc0b6minfrin the scheme, hostname and port of the current virtual host is used to construct
4aef34911af88f96c5b6d9b71a550a5a97bbc0b6minfrin the cache key. When a cluster of machines is present, and all cached entries
4aef34911af88f96c5b6d9b71a550a5a97bbc0b6minfrin should be cached beneath the same cache key, a new base URL can be specified
4aef34911af88f96c5b6d9b71a550a5a97bbc0b6minfrin with this directive.</p>
4aef34911af88f96c5b6d9b71a550a5a97bbc0b6minfrin
4aef34911af88f96c5b6d9b71a550a5a97bbc0b6minfrin <example>
4aef34911af88f96c5b6d9b71a550a5a97bbc0b6minfrin # Override the base URL of the cache key.<br />
4aef34911af88f96c5b6d9b71a550a5a97bbc0b6minfrin CacheKeyBaseURL http://www.example.com/<br />
4aef34911af88f96c5b6d9b71a550a5a97bbc0b6minfrin </example>
4aef34911af88f96c5b6d9b71a550a5a97bbc0b6minfrin
4aef34911af88f96c5b6d9b71a550a5a97bbc0b6minfrin <note type="warning">Take care when setting this directive. If two separate virtual
4aef34911af88f96c5b6d9b71a550a5a97bbc0b6minfrin hosts are accidentally given the same base URL, entries from one virtual host
4aef34911af88f96c5b6d9b71a550a5a97bbc0b6minfrin will be served to the other.</note>
4aef34911af88f96c5b6d9b71a550a5a97bbc0b6minfrin
4aef34911af88f96c5b6d9b71a550a5a97bbc0b6minfrin</usage>
4aef34911af88f96c5b6d9b71a550a5a97bbc0b6minfrin</directivesynopsis>
4aef34911af88f96c5b6d9b71a550a5a97bbc0b6minfrin
f4a0825e91eec135b5e41c697439e9a13014fa2cminfrin<directivesynopsis>
f4a0825e91eec135b5e41c697439e9a13014fa2cminfrin<name>CacheStaleOnError</name>
f4a0825e91eec135b5e41c697439e9a13014fa2cminfrin<description>Serve stale content in place of 5xx responses.</description>
f4a0825e91eec135b5e41c697439e9a13014fa2cminfrin<syntax>CacheStaleOnError <var>on|off</var></syntax>
f4a0825e91eec135b5e41c697439e9a13014fa2cminfrin<default>CacheStaleOnError on</default>
f4a0825e91eec135b5e41c697439e9a13014fa2cminfrin<contextlist><context>server config</context>
f4a0825e91eec135b5e41c697439e9a13014fa2cminfrin <context>virtual host</context>
f4a0825e91eec135b5e41c697439e9a13014fa2cminfrin <context>directory</context>
f4a0825e91eec135b5e41c697439e9a13014fa2cminfrin <context>.htaccess</context>
f4a0825e91eec135b5e41c697439e9a13014fa2cminfrin</contextlist>
f4a0825e91eec135b5e41c697439e9a13014fa2cminfrin<compatibility>Available in Apache 2.3.9 and later</compatibility>
f4a0825e91eec135b5e41c697439e9a13014fa2cminfrin
f4a0825e91eec135b5e41c697439e9a13014fa2cminfrin<usage>
f4a0825e91eec135b5e41c697439e9a13014fa2cminfrin <p>When the <directive module="mod_cache">CacheStaleOnError</directive> directive
f4a0825e91eec135b5e41c697439e9a13014fa2cminfrin is switched on, and when stale data is available in the cache, the cache will
f4a0825e91eec135b5e41c697439e9a13014fa2cminfrin respond to 5xx responses from the backend by returning the stale data instead of
f4a0825e91eec135b5e41c697439e9a13014fa2cminfrin the 5xx response. While the Cache-Control headers sent by clients will be respected,
f4a0825e91eec135b5e41c697439e9a13014fa2cminfrin and the raw 5xx responses returned to the client on request, the 5xx response so
f4a0825e91eec135b5e41c697439e9a13014fa2cminfrin returned to the client will not invalidate the content in the cache.</p>
f4a0825e91eec135b5e41c697439e9a13014fa2cminfrin
f4a0825e91eec135b5e41c697439e9a13014fa2cminfrin <example>
f4a0825e91eec135b5e41c697439e9a13014fa2cminfrin # Serve stale data on error.<br />
f4a0825e91eec135b5e41c697439e9a13014fa2cminfrin CacheStaleOnError on<br />
f4a0825e91eec135b5e41c697439e9a13014fa2cminfrin </example>
f4a0825e91eec135b5e41c697439e9a13014fa2cminfrin
f4a0825e91eec135b5e41c697439e9a13014fa2cminfrin</usage>
f4a0825e91eec135b5e41c697439e9a13014fa2cminfrin</directivesynopsis>
f4a0825e91eec135b5e41c697439e9a13014fa2cminfrin
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard</modulesynopsis>