</usage>
</directivesynopsis>
+<directivesynopsis>
+<name>CacheStoreExpired</name>
+<description>Attempt to cache responses that the server reports as expired</description>
+<syntax>CacheStoreExpired On|Off</syntax>
+<default>CacheStoreExpired Off</default>
+<contextlist><context>server config</context><context>virtual host</context>
+</contextlist>
+
+<usage>
+ <p>Since httpd 2.2.4, responses which are already-expired are not stored
+ stored in the cache. The <directive>CacheStoreExpired</directive>
+ directive allows this behavior to be overridden.
+ <directive>CacheStoreExpired</directive> On
+ tells the server to attempt to cache the resource if it is stale.
+ Subsequent requests would trigger an If-Modified-Since request of
+ the origin server, and the response may be fulfilled from cache
+ if the backend resource has not changed.</p>
+
+ <example>
+ CacheStoreExpired On
+ </example>
+</usage>
+</directivesynopsis>
+
<directivesynopsis>
<name>CacheStorePrivate</name>
<description>Attempt to cache responses that the server has marked as private</description>
/* if a broken Expires header is present, don't cache it */
reason = apr_pstrcat(p, "Broken expires header: ", exps, NULL);
}
- else if (exp != APR_DATE_BAD && exp < r->request_time)
+ else if (!conf->store_expired && exp != APR_DATE_BAD
+ && exp < r->request_time)
{
/* if a Expires header is in the past, don't cache it */
reason = "Expires header already expired, not cacheable";
ps->no_last_mod_ignore = 0;
ps->ignorecachecontrol = 0;
ps->ignorecachecontrol_set = 0;
+ ps->store_expired = 0;
+ ps->store_expired_set = 0;
ps->store_private = 0;
ps->store_private_set = 0;
ps->store_nostore = 0;
(overrides->ignorecachecontrol_set == 0)
? base->ignorecachecontrol
: overrides->ignorecachecontrol;
+ ps->store_expired =
+ (overrides->store_expired_set == 0)
+ ? base->store_expired
+ : overrides->store_expired;
ps->store_private =
(overrides->store_private_set == 0)
? base->store_private
return NULL;
}
+static const char *set_cache_store_expired(cmd_parms *parms, void *dummy,
+ int flag)
+{
+ cache_server_conf *conf;
+
+ conf =
+ (cache_server_conf *)ap_get_module_config(parms->server->module_config,
+ &cache_module);
+ conf->store_expired = flag;
+ conf->store_expired_set = 1;
+ return NULL;
+}
+
static const char *set_cache_store_private(cmd_parms *parms, void *dummy,
int flag)
{
AP_INIT_FLAG("CacheIgnoreCacheControl", set_cache_ignore_cachecontrol,
NULL, RSRC_CONF,
"Ignore requests from the client for uncached content"),
+ AP_INIT_FLAG("CacheStoreExpired", set_cache_store_expired,
+ NULL, RSRC_CONF,
+ "Ignore expiration dates when populating cache, resulting in "
+ "an If-Modified-Since request to the backend on retrieval"),
AP_INIT_FLAG("CacheStorePrivate", set_cache_store_private,
NULL, RSRC_CONF,
"Ignore 'Cache-Control: private' and store private content"),