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.
f312a039cc79d35be2dcb8aa20d91b31b9394c9fminfrin<description>RFC 2616 compliant HTTP caching filter.</description>
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
8b226aa868d55e93fc6da72323a5e1542027c411rbowen module="mod_access_compat">Allow</directive> and <directive
8b226aa868d55e93fc6da72323a5e1542027c411rbowen module="mod_access_compat">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>
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 <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 <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 <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 <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 <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 <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 <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 <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 <p><module>mod_cache</module> requires the services of one or more
5df82feb5bbe57f91f774801e1118edb5e2c87d7jailletc storage management modules. The following storage management modules are included in
3e5f26422e7931e8838f3c844adc4282ef269cdfstoddard the base Apache distribution:</p>
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>
0734f81384d5f2528bb119f89d135043a280d5b2minfrin <dd>Implements a shared object cache based storage manager. Headers and
0734f81384d5f2528bb119f89d135043a280d5b2minfrin bodies are stored together beneath a single key based on the URL of the
0734f81384d5f2528bb119f89d135043a280d5b2minfrin response being cached. Multiple content negotiated responses can
0734f81384d5f2528bb119f89d135043a280d5b2minfrin be stored concurrently, however the caching of partial content is not
0734f81384d5f2528bb119f89d135043a280d5b2minfrin supported by this module.</dd>
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>
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>
0734f81384d5f2528bb119f89d135043a280d5b2minfrin <directive module="mod_cache_socache">CacheSocache</directive>
0734f81384d5f2528bb119f89d135043a280d5b2minfrin <directive module="mod_cache_socache">CacheSocacheMaxTime</directive>
0734f81384d5f2528bb119f89d135043a280d5b2minfrin <directive module="mod_cache_socache">CacheSocacheMinTime</directive>
0734f81384d5f2528bb119f89d135043a280d5b2minfrin <directive module="mod_cache_socache">CacheSocacheMaxSize</directive>
0734f81384d5f2528bb119f89d135043a280d5b2minfrin <directive module="mod_cache_socache">CacheSocacheReadSize</directive>
0734f81384d5f2528bb119f89d135043a280d5b2minfrin <directive module="mod_cache_socache">CacheSocacheReadTime</directive>
1e5b300cc68389a18fe3762b1b980b0c86712ba1stoddard </directivelist>
15f37a157fbbf107658ed82ec30c348a9b6e518end<section id="sampleconf"><title>Sample Configuration</title>
d84dc356814b255affe3abe2ad93ce17f98e632chumbedooh# Sample Cache Configuration
d84dc356814b255affe3abe2ad93ce17f98e632chumbedooh<IfModule mod_cache.c>
d84dc356814b255affe3abe2ad93ce17f98e632chumbedooh LoadModule cache_disk_module modules/mod_cache_disk.so
d84dc356814b255affe3abe2ad93ce17f98e632chumbedooh <IfModule mod_cache_disk.c>
d84dc356814b255affe3abe2ad93ce17f98e632chumbedooh CacheRoot c:/cacheroot
d84dc356814b255affe3abe2ad93ce17f98e632chumbedooh CacheEnable disk /
d84dc356814b255affe3abe2ad93ce17f98e632chumbedooh CacheDirLevels 5
d84dc356814b255affe3abe2ad93ce17f98e632chumbedooh CacheDirLength 3
d84dc356814b255affe3abe2ad93ce17f98e632chumbedooh </IfModule>
d84dc356814b255affe3abe2ad93ce17f98e632chumbedooh # When acting as a proxy, don't cache the list of security updates
d84dc356814b255affe3abe2ad93ce17f98e632chumbedooh CacheDisable http://security.update.server/update-list/
d84dc356814b255affe3abe2ad93ce17f98e632chumbedooh</IfModule>
d84dc356814b255affe3abe2ad93ce17f98e632chumbedooh </highlight>
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
f7f7fdc0557bf57f1b50982c88d422d743aa2f12humbedooh suddenly and unpredictably.</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
d84dc356814b255affe3abe2ad93ce17f98e632chumbedooh# Enable the cache lock
d84dc356814b255affe3abe2ad93ce17f98e632chumbedooh<IfModule mod_cache.c>
d84dc356814b255affe3abe2ad93ce17f98e632chumbedooh CacheLock on
d84dc356814b255affe3abe2ad93ce17f98e632chumbedooh CacheLockMaxAge 5
d84dc356814b255affe3abe2ad93ce17f98e632chumbedooh</IfModule>
d84dc356814b255affe3abe2ad93ce17f98e632chumbedooh </highlight>
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,
f312a039cc79d35be2dcb8aa20d91b31b9394c9fminfrin acting as if a free standing RFC 2616 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
533eb7d07b98c0010da206841099b9c0aaa657d0covener cached page, or to apply authorization 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
533eb7d07b98c0010da206841099b9c0aaa657d0covener <strong>authentication and authorization</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>
d84dc356814b255affe3abe2ad93ce17f98e632chumbedooh# Cache content before optional compression
d84dc356814b255affe3abe2ad93ce17f98e632chumbedoohCacheQuickHandler off
d84dc356814b255affe3abe2ad93ce17f98e632chumbedooh </highlight>
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>
d84dc356814b255affe3abe2ad93ce17f98e632chumbedooh# Cache content before mod_include and mod_deflate
d84dc356814b255affe3abe2ad93ce17f98e632chumbedoohCacheQuickHandler off
d84dc356814b255affe3abe2ad93ce17f98e632chumbedoohAddOutputFilterByType CACHE;INCLUDES;DEFLATE text/html
d84dc356814b255affe3abe2ad93ce17f98e632chumbedooh </highlight>
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
d84dc356814b255affe3abe2ad93ce17f98e632chumbedooh# Cache content between mod_include and mod_deflate
d84dc356814b255affe3abe2ad93ce17f98e632chumbedoohCacheQuickHandler off
d84dc356814b255affe3abe2ad93ce17f98e632chumbedoohAddOutputFilterByType INCLUDES;CACHE;DEFLATE text/html
d84dc356814b255affe3abe2ad93ce17f98e632chumbedooh </highlight>
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 ..."
d84dc356814b255affe3abe2ad93ce17f98e632chumbedooh </highlight>
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 <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 <p>This makes it possible to support conditional logging of cached requests
033d82412cc4af9d939b7e1645425b9e7f4ebf60minfrin as per the following example:</p>
aaed4ebc116f5862aff2610a809a9a9e9a28f50ecoarCustomLog "cached-requests.log" common env=cache-hit
aaed4ebc116f5862aff2610a809a9a9e9a28f50ecoarCustomLog "uncached-requests.log" common env=cache-miss
aaed4ebc116f5862aff2610a809a9a9e9a28f50ecoarCustomLog "revalidated-requests.log" common env=cache-revalidate
aaed4ebc116f5862aff2610a809a9a9e9a28f50ecoarCustomLog "invalidated-requests.log" common env=cache-invalidate
d84dc356814b255affe3abe2ad93ce17f98e632chumbedooh </highlight>
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
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard<directivesynopsis>
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>
86286cf8580daca5c836fb1e025ea258bd907c7atakashi</contextlist>
6d9960bc86ee9fab63a6cbd6793540fa8ef5e232covener<compatibility>A url-string of '/' applied to forward proxy content in 2.2 and
6d9960bc86ee9fab63a6cbd6793540fa8ef5e232covener earlier.</compatibility>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard <p>The <directive>CacheEnable</directive> directive instructs
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">LocationMatch</directive> sections to indicate
ffae06377667a5d8f9699ac7512134de7000a83dminfrin the content is cacheable.
62e52789bfc10a5fd0a433af77e77c8ebbbed6c2rederpj <module>mod_cache</module> to use the disk based storage manager
0734f81384d5f2528bb119f89d135043a280d5b2minfrin implemented by <module>mod_cache_disk</module>. <var>cache_type</var>
0734f81384d5f2528bb119f89d135043a280d5b2minfrin <code>socache</code> instructs <module>mod_cache</module> to use the
0734f81384d5f2528bb119f89d135043a280d5b2minfrin shared object cache based storage manager implemented by
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>
5d01f40ffd657dd2ac567aacd93cabd162ddfa79coar <p>When acting as a forward proxy server, <var>url-string</var> must
6d9960bc86ee9fab63a6cbd6793540fa8ef5e232covener minimally begin with a protocol for which caching should be enabled.</p>
cf3b846a57269ed58f40136b7e60df52cdcc7a52minfrin# Cache content (normal handler only)
cf3b846a57269ed58f40136b7e60df52cdcc7a52minfrinCacheQuickHandler off
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar<Location "/foo">
d84dc356814b255affe3abe2ad93ce17f98e632chumbedooh CacheEnable disk
d84dc356814b255affe3abe2ad93ce17f98e632chumbedooh</Location>
cf3b846a57269ed58f40136b7e60df52cdcc7a52minfrin# Cache regex (normal handler only)
cf3b846a57269ed58f40136b7e60df52cdcc7a52minfrinCacheQuickHandler off
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar<LocationMatch "foo$">
d84dc356814b255affe3abe2ad93ce17f98e632chumbedooh CacheEnable disk
d84dc356814b255affe3abe2ad93ce17f98e632chumbedooh</LocationMatch>
6d9960bc86ee9fab63a6cbd6793540fa8ef5e232covener# Cache all but forward proxy url's (normal or quick handler)
d84dc356814b255affe3abe2ad93ce17f98e632chumbedoohCacheEnable disk /
cf3b846a57269ed58f40136b7e60df52cdcc7a52minfrin# Cache FTP-proxied url's (normal or quick handler)
d84dc356814b255affe3abe2ad93ce17f98e632chumbedoohCacheEnable disk ftp://
6d9960bc86ee9fab63a6cbd6793540fa8ef5e232covener# Cache forward proxy content from www.example.org (normal or quick handler)
d84dc356814b255affe3abe2ad93ce17f98e632chumbedooh </highlight>
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>
d84dc356814b255affe3abe2ad93ce17f98e632chumbedooh </highlight>
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<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>
ffae06377667a5d8f9699ac7512134de7000a83dminfrin<context>directory</context><context>.htaccess</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
d84dc356814b255affe3abe2ad93ce17f98e632chumbedooh </highlight>
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>
1f1b6bf13313fdd14a45e52e553d3ff28689b717coar<Location "/foo">
d84dc356814b255affe3abe2ad93ce17f98e632chumbedooh CacheDisable on
d84dc356814b255affe3abe2ad93ce17f98e632chumbedooh</Location>
d84dc356814b255affe3abe2ad93ce17f98e632chumbedooh </highlight>
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<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
d84dc356814b255affe3abe2ad93ce17f98e632chumbedooh </highlight>
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
d84dc356814b255affe3abe2ad93ce17f98e632chumbedooh </highlight>
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
d84dc356814b255affe3abe2ad93ce17f98e632chumbedooh </highlight>
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
d84dc356814b255affe3abe2ad93ce17f98e632chumbedooh </highlight>
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
5d01f40ffd657dd2ac567aacd93cabd162ddfa79coar if the request contains no-cache header values.</p>
15f37a157fbbf107658ed82ec30c348a9b6e518end CacheIgnoreCacheControl On
d84dc356814b255affe3abe2ad93ce17f98e632chumbedooh </highlight>
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
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 CacheIgnoreQueryString On
d84dc356814b255affe3abe2ad93ce17f98e632chumbedooh </highlight>
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
d84dc356814b255affe3abe2ad93ce17f98e632chumbedooh </highlight>
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
d84dc356814b255affe3abe2ad93ce17f98e632chumbedooh </highlight>
a80dd6ffd7a1484e7f45e4665689bdd84fc97153jerenkrantz CacheIgnoreHeaders None
d84dc356814b255affe3abe2ad93ce17f98e632chumbedooh </highlight>
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
d84dc356814b255affe3abe2ad93ce17f98e632chumbedooh </highlight>
186e9d990f453d16826ab87a87df7b87e6e05921rpluem CacheIgnoreURLSessionIdentifiers None
d84dc356814b255affe3abe2ad93ce17f98e632chumbedooh </highlight>
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
d84dc356814b255affe3abe2ad93ce17f98e632chumbedooh </highlight>
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
b7d83d463cc3ea447283a652d13837392384022ccovener private header values.</p>
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz CacheStorePrivate On
d84dc356814b255affe3abe2ad93ce17f98e632chumbedooh </highlight>
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
12a677ce91b7bd5aa918271de5d725635638f4edrbowen <directive>CacheStoreNoStore</directive> directive allows this
12a677ce91b7bd5aa918271de5d725635638f4edrbowen behavior to be overridden. <directive>CacheStoreNoStore</directive> On
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz tells the server to attempt to cache the resource even if it contains
b7d83d463cc3ea447283a652d13837392384022ccovener no-store header values.</p>
5c6cb72bfeee541644cea8177aefce1157571d3bjerenkrantz CacheStoreNoStore On
d84dc356814b255affe3abe2ad93ce17f98e632chumbedooh </highlight>
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>
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
c967bf3bc89e8aa60dbd30d9da388e448ddc1cc4trawick enable the thundering herd lock in the default run-time file directory.</p>
d84dc356814b255affe3abe2ad93ce17f98e632chumbedooh# Enable cache lock
d84dc356814b255affe3abe2ad93ce17f98e632chumbedooh </highlight>
c967bf3bc89e8aa60dbd30d9da388e448ddc1cc4trawick <p>Locks consist of empty files that only exist for stale URLs in flight, so this
c967bf3bc89e8aa60dbd30d9da388e448ddc1cc4trawick is significantly less resource intensive than the traditional disk cache.</p>
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
c967bf3bc89e8aa60dbd30d9da388e448ddc1cc4trawick directory in which the locks are created. If <var>directory</var> is not an absolute
5d01f40ffd657dd2ac567aacd93cabd162ddfa79coar path, the location specified will be relative to the value of
c967bf3bc89e8aa60dbd30d9da388e448ddc1cc4trawick <directive module="core">DefaultRuntimeDir</directive>.</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>
0e7b9978df6fac23db4330b09e890cf6de6ff7b6covener <compatibility>Apache HTTP Server 2.3.3 and later</compatibility>
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
533eb7d07b98c0010da206841099b9c0aaa657d0covener processing is required, such as when content is subject to authorization.</p>
d84dc356814b255affe3abe2ad93ce17f98e632chumbedooh# Run cache as a normal handler
d84dc356814b255affe3abe2ad93ce17f98e632chumbedoohCacheQuickHandler off
d84dc356814b255affe3abe2ad93ce17f98e632chumbedooh </highlight>
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>
d84dc356814b255affe3abe2ad93ce17f98e632chumbedooh# Cache content before mod_include and mod_deflate
d84dc356814b255affe3abe2ad93ce17f98e632chumbedoohCacheQuickHandler off
d84dc356814b255affe3abe2ad93ce17f98e632chumbedoohAddOutputFilterByType CACHE;INCLUDES;DEFLATE text/html
d84dc356814b255affe3abe2ad93ce17f98e632chumbedooh </highlight>
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
a6fc6b44b7f8ad7390864b3555341d3abf867f7end directive may appear within a <directive type="section" module="core">Directory</directive>
a6fc6b44b7f8ad7390864b3555341d3abf867f7end or <directive type="section" 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>
d84dc356814b255affe3abe2ad93ce17f98e632chumbedooh# Enable the X-Cache header
d84dc356814b255affe3abe2ad93ce17f98e632chumbedoohCacheHeader on
d84dc356814b255affe3abe2ad93ce17f98e632chumbedooh </highlight>
d84dc356814b255affe3abe2ad93ce17f98e632chumbedooh X-Cache: HIT from localhost
d84dc356814b255affe3abe2ad93ce17f98e632chumbedooh </highlight>
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
a6fc6b44b7f8ad7390864b3555341d3abf867f7end <directive type="section" module="core">Directory</directive> or
a6fc6b44b7f8ad7390864b3555341d3abf867f7end <directive type="section" 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>
d84dc356814b255affe3abe2ad93ce17f98e632chumbedooh# Enable the X-Cache-Detail header
d84dc356814b255affe3abe2ad93ce17f98e632chumbedoohCacheDetailHeader on
d84dc356814b255affe3abe2ad93ce17f98e632chumbedooh </highlight>
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>
d84dc356814b255affe3abe2ad93ce17f98e632chumbedooh# Override the base URL of the cache key.
d84dc356814b255affe3abe2ad93ce17f98e632chumbedooh </highlight>
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>
d84dc356814b255affe3abe2ad93ce17f98e632chumbedooh# Serve stale data on error.
d84dc356814b255affe3abe2ad93ce17f98e632chumbedoohCacheStaleOnError on
d84dc356814b255affe3abe2ad93ce17f98e632chumbedooh </highlight>
f4a0825e91eec135b5e41c697439e9a13014fa2cminfrin</directivesynopsis>
721fdd19e2abef2e8dc46eb5c022ef14efe3367estoddard</modulesynopsis>