mod_cache.xml revision f4a0825e91eec135b5e41c697439e9a13014fa2c
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard<!DOCTYPE modulesynopsis SYSTEM "/style/modulesynopsis.dtd">
e942c741056732f50da2074b36fe59805d370650slive<?xml-stylesheet type="text/xsl" href="/style/manual.en.xsl"?>
5f5d1b4cc970b7f06ff8ef6526128e9a27303d88nd<!-- $LastChangedRevision$ -->
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 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.
1e5b300cc68389a18fe3762b1b980b0c86712ba1stoddard<description>Content cache keyed to URIs.</description>
7b467aa53854c95318a1c709709c1619a4f47118minfrin <note type="warning">This module should be used with care, as when the
7b467aa53854c95318a1c709709c1619a4f47118minfrin <directive module="mod_cache">CacheQuickHandler</directive> directive is
7b467aa53854c95318a1c709709c1619a4f47118minfrin in its default value of <strong>on</strong>, the <directive
b77f6f03c0b6bbc6ecd6e87358f568024733d680colm 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
b77f6f03c0b6bbc6ecd6e87358f568024733d680colm variable.</note>
15f37a157fbbf107658ed82ec30c348a9b6e518end href="http://www.ietf.org/rfc/rfc2616.txt">RFC 2616</a> compliant HTTP
15f37a157fbbf107658ed82ec30c348a9b6e518end content cache that can be used to cache either local or proxied content.
15f37a157fbbf107658ed82ec30c348a9b6e518end <module>mod_cache</module> requires the services of one or more storage
1a2bc936a6b4aaf5713c98a230a449fd878d1f06takashi management modules. One storage management module is included in
3e5f26422e7931e8838f3c844adc4282ef269cdfstoddard the base Apache distribution:</p>
62e52789bfc10a5fd0a433af77e77c8ebbbed6c2rederpj <p>Content is stored in and retrieved from the cache using URI based keys. Content with
62e52789bfc10a5fd0a433af77e77c8ebbbed6c2rederpj access protection is not cached.</p>
b536777217c919cacb1a6f18eaeff001f3b3f13crbowen <p>Further details, discussion, and examples, are provided in the
b536777217c919cacb1a6f18eaeff001f3b3f13crbowen<seealso><a href="/caching.html">Caching Guide</a></seealso>
88c775368960b64afcdfd93a812f466a109746baerikabele<section id="related"><title>Related Modules and Directives</title>
1e5b300cc68389a18fe3762b1b980b0c86712ba1stoddard <modulelist>
1e5b300cc68389a18fe3762b1b980b0c86712ba1stoddard </modulelist>
1e5b300cc68389a18fe3762b1b980b0c86712ba1stoddard <directivelist>
1e5b300cc68389a18fe3762b1b980b0c86712ba1stoddard <directive module="mod_disk_cache">CacheRoot</directive>
1e5b300cc68389a18fe3762b1b980b0c86712ba1stoddard <directive module="mod_disk_cache">CacheDirLevels</directive>
1e5b300cc68389a18fe3762b1b980b0c86712ba1stoddard <directive module="mod_disk_cache">CacheDirLength</directive>
1e5b300cc68389a18fe3762b1b980b0c86712ba1stoddard <directive module="mod_disk_cache">CacheMinFileSize</directive>
1e5b300cc68389a18fe3762b1b980b0c86712ba1stoddard <directive module="mod_disk_cache">CacheMaxFileSize</directive>
1e5b300cc68389a18fe3762b1b980b0c86712ba1stoddard </directivelist>
15f37a157fbbf107658ed82ec30c348a9b6e518end<section id="sampleconf"><title>Sample Configuration</title>
15f37a157fbbf107658ed82ec30c348a9b6e518end # Sample Cache Configuration<br />
1a2bc936a6b4aaf5713c98a230a449fd878d1f06takashi LoadModule disk_cache_module modules/mod_disk_cache.so<br />
15f37a157fbbf107658ed82ec30c348a9b6e518end CacheRoot c:/cacheroot<br />
15f37a157fbbf107658ed82ec30c348a9b6e518end CacheEnable disk /<br />
15f37a157fbbf107658ed82ec30c348a9b6e518end CacheDirLevels 5<br />
15f37a157fbbf107658ed82ec30c348a9b6e518end CacheDirLength 3<br />
15f37a157fbbf107658ed82ec30c348a9b6e518end </IfModule> <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 </IfModule>
15f37a157fbbf107658ed82ec30c348a9b6e518end </example>
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>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>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 <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 # Enable the cache lock<br />
3c67b7956d44501360506a9f13a5011be73b30ecminfrin CacheLock on<br />
3c67b7956d44501360506a9f13a5011be73b30ecminfrin CacheLockMaxAge 5<br />
3c67b7956d44501360506a9f13a5011be73b30ecminfrin </IfModule>
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>
7b467aa53854c95318a1c709709c1619a4f47118minfrin <p>In this mode, the cache <strong>bolts onto</strong> the front of the server,
7b467aa53854c95318a1c709709c1619a4f47118minfrin acting as if a free standing RFC2616 caching proxy had been placed in front of
7b467aa53854c95318a1c709709c1619a4f47118minfrin the server.</p>
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 <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 <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 <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 # Cache content before optional compression<br />
7b467aa53854c95318a1c709709c1619a4f47118minfrin CacheQuickHandler off<br />
7b467aa53854c95318a1c709709c1619a4f47118minfrin AddOutputFilterByType CACHE;DEFLATE text/plain<br /><br />
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 # Cache content before mod_include and mod_deflate<br />
7b467aa53854c95318a1c709709c1619a4f47118minfrin CacheQuickHandler off<br />
7b467aa53854c95318a1c709709c1619a4f47118minfrin AddOutputFilterByType CACHE;INCLUDES;DEFLATE text/html<br /><br />
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 # Cache content between mod_include and mod_deflate<br />
7b467aa53854c95318a1c709709c1619a4f47118minfrin CacheQuickHandler off<br />
7b467aa53854c95318a1c709709c1619a4f47118minfrin AddOutputFilterByType INCLUDES;CACHE;DEFLATE text/html<br /><br />
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>
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 LogFormat "%{cache-status}e ..."
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin <p>Based on the caching decision made, the reason is also written to the
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin subprocess environment under one the following three keys, as appropriate:</p>
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>
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin <p>This makes it possible to support conditional logging of cached requests
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin as per the following example:</p>
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 />
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard<directivesynopsis>
62e52789bfc10a5fd0a433af77e77c8ebbbed6c2rederpj<description>Enable caching of specified URLs using a specified storage
15f37a157fbbf107658ed82ec30c348a9b6e518endmanager</description>
15f37a157fbbf107658ed82ec30c348a9b6e518end<syntax>CacheEnable <var>cache_type</var> <var>url-string</var></syntax>
15f37a157fbbf107658ed82ec30c348a9b6e518end<contextlist><context>server config</context><context>virtual host</context>
15f37a157fbbf107658ed82ec30c348a9b6e518end</contextlist>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard <p>The <directive>CacheEnable</directive> directive instructs
62e52789bfc10a5fd0a433af77e77c8ebbbed6c2rederpj <var>url-string</var>. The cache storage manager is specified with the
ed6dfb7d7057dc4f42348f12d7bff9fe98fc73cfminfrin <var>cache_type</var> argument. If the <directive>CacheEnable</directive>
ed6dfb7d7057dc4f42348f12d7bff9fe98fc73cfminfrin directive is placed inside a <directive type="section">Location</directive>
ed6dfb7d7057dc4f42348f12d7bff9fe98fc73cfminfrin directive, the <var>url-string</var> becomes optional.
62e52789bfc10a5fd0a433af77e77c8ebbbed6c2rederpj <module>mod_cache</module> to use the disk based storage manager
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>
62e52789bfc10a5fd0a433af77e77c8ebbbed6c2rederpj directives in the configuration file.</p>
89ebbccde2b87b469b9d6fdb606eeb943c12a824colm <p>When acting as a forward proxy server, <var>url-string</var> can
89ebbccde2b87b469b9d6fdb606eeb943c12a824colm also be used to specify remote sites and proxy protocols which
89ebbccde2b87b469b9d6fdb606eeb943c12a824colm caching should be enabled for.</p>
89ebbccde2b87b469b9d6fdb606eeb943c12a824colm # Cache proxied url's<br />
89ebbccde2b87b469b9d6fdb606eeb943c12a824colm # Cache FTP-proxied url's<br />
89ebbccde2b87b469b9d6fdb606eeb943c12a824colm </example>
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>
8d36abdf61277cb8ffcecc763c8a86c28f11f8e9covener <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<seealso><a href="/env.html">Environment Variables in Apache</a></seealso>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard</directivesynopsis>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard<directivesynopsis>
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>
15f37a157fbbf107658ed82ec30c348a9b6e518end</contextlist>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard <p>The <directive>CacheDisable</directive> directive instructs
15f37a157fbbf107658ed82ec30c348a9b6e518end <module>mod_cache</module> to <em>not</em> cache urls at or below
62e52789bfc10a5fd0a433af77e77c8ebbbed6c2rederpj CacheDisable /local_files
15f37a157fbbf107658ed82ec30c348a9b6e518end </example>
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 <Location /foo><br />
ed6dfb7d7057dc4f42348f12d7bff9fe98fc73cfminfrin CacheDisable on<br />
ed6dfb7d7057dc4f42348f12d7bff9fe98fc73cfminfrin </Location><br />
8d36abdf61277cb8ffcecc763c8a86c28f11f8e9covener <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<seealso><a href="/env.html">Environment Variables in Apache</a></seealso>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard</directivesynopsis>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard<directivesynopsis>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard<description>The maximum time in seconds to cache a document</description>
15f37a157fbbf107658ed82ec30c348a9b6e518end</contextlist>
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 CacheMaxExpire 604800
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard</directivesynopsis>
1b0dce86d7fc8a5aa4c89b05255be26e508c615crpluem<directivesynopsis>
1b0dce86d7fc8a5aa4c89b05255be26e508c615crpluem<description>The minimum time in seconds to cache a document</description>
1b0dce86d7fc8a5aa4c89b05255be26e508c615crpluem</contextlist>
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 CacheMinExpire 3600
1b0dce86d7fc8a5aa4c89b05255be26e508c615crpluem</directivesynopsis>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard<directivesynopsis>
62e52789bfc10a5fd0a433af77e77c8ebbbed6c2rederpj<description>The default duration to cache a document when no expiry date is specified.</description>
88c775368960b64afcdfd93a812f466a109746baerikabele<default>CacheDefaultExpire 3600 (one hour)</default>
15f37a157fbbf107658ed82ec30c348a9b6e518end</contextlist>
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 CacheDefaultExpire 86400
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard</directivesynopsis>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard<directivesynopsis>
62e52789bfc10a5fd0a433af77e77c8ebbbed6c2rederpj<description>Ignore the fact that a response has no Last Modified
62e52789bfc10a5fd0a433af77e77c8ebbbed6c2rederpjheader.</description>
15f37a157fbbf107658ed82ec30c348a9b6e518end</contextlist>
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>
15f37a157fbbf107658ed82ec30c348a9b6e518end CacheIgnoreNoLastMod On
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard</directivesynopsis>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard<directivesynopsis>
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz<description>Ignore request to not serve cached content to client</description>
15f37a157fbbf107658ed82ec30c348a9b6e518end<contextlist><context>server config</context><context>virtual host</context>
15f37a157fbbf107658ed82ec30c348a9b6e518end</contextlist>
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>
15f37a157fbbf107658ed82ec30c348a9b6e518end CacheIgnoreCacheControl On
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<seealso><directive module="mod_cache">CacheStorePrivate</directive></seealso>
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz<seealso><directive module="mod_cache">CacheStoreNoStore</directive></seealso>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard</directivesynopsis>
fc3182e72cf0679cbf14a95213fbb9a98c3cf597rpluem<directivesynopsis>
fc3182e72cf0679cbf14a95213fbb9a98c3cf597rpluem<description>Ignore query string when caching</description>
fc3182e72cf0679cbf14a95213fbb9a98c3cf597rpluem<contextlist><context>server config</context><context>virtual host</context>
fc3182e72cf0679cbf14a95213fbb9a98c3cf597rpluem</contextlist>
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
fc3182e72cf0679cbf14a95213fbb9a98c3cf597rpluem if an expiration time is specified. The
fc3182e72cf0679cbf14a95213fbb9a98c3cf597rpluem <directive>CacheIgnoreQueryString</directive> directive tells the cache to
fc3182e72cf0679cbf14a95213fbb9a98c3cf597rpluem 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
fc3182e72cf0679cbf14a95213fbb9a98c3cf597rpluem view the request is treated as if having no query string when this
fc3182e72cf0679cbf14a95213fbb9a98c3cf597rpluem directive is enabled.</p>
fc3182e72cf0679cbf14a95213fbb9a98c3cf597rpluem CacheIgnoreQueryString On
fc3182e72cf0679cbf14a95213fbb9a98c3cf597rpluem</directivesynopsis>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard<directivesynopsis>
62e52789bfc10a5fd0a433af77e77c8ebbbed6c2rederpj<description>The factor used to compute an expiry date based on the
62e52789bfc10a5fd0a433af77e77c8ebbbed6c2rederpjLastModified date.</description>
15f37a157fbbf107658ed82ec30c348a9b6e518end</contextlist>
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 <code>expiry-period = time-since-last-modified-date * <var>factor</var>
62e52789bfc10a5fd0a433af77e77c8ebbbed6c2rederpj expiry-date = current-date + expiry-period</code>
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 If the expiry-period would be longer than that set by
62e52789bfc10a5fd0a433af77e77c8ebbbed6c2rederpj <directive>CacheMaxExpire</directive>, then the latter takes
62e52789bfc10a5fd0a433af77e77c8ebbbed6c2rederpj precedence.</p>
15f37a157fbbf107658ed82ec30c348a9b6e518end CacheLastModifiedFactor 0.5
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard</directivesynopsis>
1e5b300cc68389a18fe3762b1b980b0c86712ba1stoddard<directivesynopsis>
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<contextlist><context>server config</context><context>virtual host</context>
a80dd6ffd7a1484e7f45e4665689bdd84fc97153jerenkrantz</contextlist>
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 <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 <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 CacheIgnoreHeaders Set-Cookie
a80dd6ffd7a1484e7f45e4665689bdd84fc97153jerenkrantz CacheIgnoreHeaders None
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</directivesynopsis>
186e9d990f453d16826ab87a87df7b87e6e05921rpluem<directivesynopsis>
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 <p>Sometimes applications encode the session identifier into the URL like in the following
186e9d990f453d16826ab87a87df7b87e6e05921rpluem <li><code>/someapplication/image.gif;jsessionid=123456789</code></li>
186e9d990f453d16826ab87a87df7b87e6e05921rpluem <li><code>/someapplication/image.gif?PHPSESSIONID=12345678</code></li>
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.
65ada7c754866f293fce01f3e6278122b4c44848rpluem <p><code>CacheIgnoreURLSessionIdentifiers None</code> clears the list of ignored
65ada7c754866f293fce01f3e6278122b4c44848rpluem identifiers. Otherwise, each identifier is added to the list.</p>
186e9d990f453d16826ab87a87df7b87e6e05921rpluem CacheIgnoreURLSessionIdentifiers jsessionid
186e9d990f453d16826ab87a87df7b87e6e05921rpluem CacheIgnoreURLSessionIdentifiers None
186e9d990f453d16826ab87a87df7b87e6e05921rpluem</directivesynopsis>
1fe05d56d6757d4b5d30b8a199f32417cc396f25wrowe<directivesynopsis>
1fe05d56d6757d4b5d30b8a199f32417cc396f25wrowe<description>Attempt to cache responses that the server reports as expired</description>
1fe05d56d6757d4b5d30b8a199f32417cc396f25wrowe</contextlist>
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 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 CacheStoreExpired On
1fe05d56d6757d4b5d30b8a199f32417cc396f25wrowe</directivesynopsis>
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz<directivesynopsis>
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz<description>Attempt to cache responses that the server has marked as private</description>
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz</contextlist>
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 tells the server to attempt to cache the resource even if it contains
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz private header values. Resources requiring authorization will
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz CacheStorePrivate On
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<seealso><directive module="mod_cache">CacheIgnoreCacheControl</directive></seealso>
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz<seealso><directive module="mod_cache">CacheStoreNoStore</directive></seealso>
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz</directivesynopsis>
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz<directivesynopsis>
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz<description>Attempt to cache requests or responses that have been marked as no-store.</description>
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz</contextlist>
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 CacheStoreNoStore On
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<seealso><directive module="mod_cache">CacheIgnoreCacheControl</directive></seealso>
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz<seealso><directive module="mod_cache">CacheStorePrivate</directive></seealso>
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz</directivesynopsis>
3c67b7956d44501360506a9f13a5011be73b30ecminfrin<directivesynopsis>
3c67b7956d44501360506a9f13a5011be73b30ecminfrin<description>Enable the thundering herd lock.</description>
3c67b7956d44501360506a9f13a5011be73b30ecminfrin<contextlist><context>server config</context><context>virtual host</context>
3c67b7956d44501360506a9f13a5011be73b30ecminfrin</contextlist>
e4926c84e8383fedec4590596a29efae1933341dtrawick<compatibility>Available in Apache 2.2.15 and later</compatibility>
3c67b7956d44501360506a9f13a5011be73b30ecminfrin <p>The <directive>CacheLock</directive> directive enables the thundering herd lock
3c67b7956d44501360506a9f13a5011be73b30ecminfrin for the given URL space.</p>
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>
03fc700cc2a7b22b84891f9595f23e40d5243b62lgentis # Enable cache lock<br />
3c67b7956d44501360506a9f13a5011be73b30ecminfrin</directivesynopsis>
3c67b7956d44501360506a9f13a5011be73b30ecminfrin<directivesynopsis>
3c67b7956d44501360506a9f13a5011be73b30ecminfrin<description>Set the lock path directory.</description>
3c67b7956d44501360506a9f13a5011be73b30ecminfrin<contextlist><context>server config</context><context>virtual host</context>
3c67b7956d44501360506a9f13a5011be73b30ecminfrin</contextlist>
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</directivesynopsis>
3c67b7956d44501360506a9f13a5011be73b30ecminfrin<directivesynopsis>
3c67b7956d44501360506a9f13a5011be73b30ecminfrin<description>Set the maximum possible age of a cache lock.</description>
3c67b7956d44501360506a9f13a5011be73b30ecminfrin<contextlist><context>server config</context><context>virtual host</context>
3c67b7956d44501360506a9f13a5011be73b30ecminfrin</contextlist>
3c67b7956d44501360506a9f13a5011be73b30ecminfrin <p>The <directive>CacheLockMaxAge</directive> directive specifies the maximum
3c67b7956d44501360506a9f13a5011be73b30ecminfrin age of any cache lock.</p>
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>
3c67b7956d44501360506a9f13a5011be73b30ecminfrin</directivesynopsis>
7b467aa53854c95318a1c709709c1619a4f47118minfrin<directivesynopsis>
7b467aa53854c95318a1c709709c1619a4f47118minfrin <description>Run the cache from the quick handler.</description>
7b467aa53854c95318a1c709709c1619a4f47118minfrin <syntax>CacheQuickHandler <var>on|off</var></syntax>
7b467aa53854c95318a1c709709c1619a4f47118minfrin <contextlist><context>server config</context><context>virtual host</context>
7b467aa53854c95318a1c709709c1619a4f47118minfrin </contextlist>
7b467aa53854c95318a1c709709c1619a4f47118minfrin <p>The <directive module="mod_cache">CacheQuickHandler</directive> directive
7b467aa53854c95318a1c709709c1619a4f47118minfrin controls the phase in which the cache is handled.</p>
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 <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 # Run cache as a normal handler<br />
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 # Cache content before mod_include and mod_deflate<br />
7b467aa53854c95318a1c709709c1619a4f47118minfrin CacheQuickHandler off<br />
7b467aa53854c95318a1c709709c1619a4f47118minfrin AddOutputFilterByType CACHE;INCLUDES;DEFLATE text/html<br /><br />
7b467aa53854c95318a1c709709c1619a4f47118minfrin <p>If the CACHE filter is specified more than once, the last instance will
7b467aa53854c95318a1c709709c1619a4f47118minfrin</directivesynopsis>
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin<directivesynopsis>
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin<description>Add an X-Cache header to the response.</description>
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin</contextlist>
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin<compatibility>Available in Apache 2.3.9 and later</compatibility>
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"><Directory></directive>
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin or <directive module="core"><Location></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 <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 # Enable the X-Cache header<br />
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin CacheHeader on<br />
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin X-Cache: HIT from localhost<br />
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin</directivesynopsis>
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin<directivesynopsis>
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin<description>Add an X-Cache-Detail header to the response.</description>
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin</contextlist>
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin<compatibility>Available in Apache 2.3.9 and later</compatibility>
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>
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>
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin <p>If the normal handler is used, this directive may appear within a
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin <directive module="core"><Directory></directive> or
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin <directive module="core"><Location></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 # Enable the X-Cache-Detail header<br />
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin CacheDetailHeader on<br />
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin X-Cache-Detail: "conditional cache hit: entity refreshed" from localhost<br />
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin</directivesynopsis>
4aef34911af88f96c5b6d9b71a550a5a97bbc0b6minfrin<directivesynopsis>
4aef34911af88f96c5b6d9b71a550a5a97bbc0b6minfrin<description>Override the base URL of reverse proxied cache keys.</description>
4aef34911af88f96c5b6d9b71a550a5a97bbc0b6minfrin<default>CacheKeyBaseURL http://example.com</default>
4aef34911af88f96c5b6d9b71a550a5a97bbc0b6minfrin</contextlist>
4aef34911af88f96c5b6d9b71a550a5a97bbc0b6minfrin<compatibility>Available in Apache 2.3.9 and later</compatibility>
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 # Override the base URL of the cache key.<br />
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</directivesynopsis>
f4a0825e91eec135b5e41c697439e9a13014fa2cminfrin<directivesynopsis>
f4a0825e91eec135b5e41c697439e9a13014fa2cminfrin<description>Serve stale content in place of 5xx responses.</description>
f4a0825e91eec135b5e41c697439e9a13014fa2cminfrin</contextlist>
f4a0825e91eec135b5e41c697439e9a13014fa2cminfrin<compatibility>Available in Apache 2.3.9 and later</compatibility>
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 # Serve stale data on error.<br />
f4a0825e91eec135b5e41c697439e9a13014fa2cminfrin CacheStaleOnError on<br />
f4a0825e91eec135b5e41c697439e9a13014fa2cminfrin</directivesynopsis>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard</modulesynopsis>