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