<p>The <directive>CacheEnable</directive> directive instructs
<module>mod_cache</module> to cache urls at or below
<var>url-string</var>. The cache storage manager is specified with the
- <var>cache_type</var> argument.
+ <var>cache_type</var> argument. If the <directive>CacheEnable</directive>
+ directive is placed inside a <directive type="section">Location</directive>
+ directive, the <var>url-string</var> becomes optional.
<var>cache_type</var> <code>disk</code> instructs
<module>mod_cache</module> to use the disk based storage manager
implemented by <module>mod_disk_cache</module>.</p>
<directivesynopsis>
<name>CacheDisable</name>
<description>Disable caching of specified URLs</description>
-<syntax>CacheDisable <var> url-string</var></syntax>
+<syntax>CacheDisable <var>url-string</var> | <var>on</var></syntax>
<contextlist><context>server config</context><context>virtual host</context>
</contextlist>
CacheDisable /local_files
</example>
+ <p>If used in a <directive type="section">Location</directive> directive,
+ the path needs to be specified below the Location, or if the word "on"
+ is used, caching for the whole location will be disabled.</p>
+
+ <example><title>Example</title>
+ <Location /foo><br />
+ CacheDisable on<br />
+ </Location><br />
+ </example>
+
<p> The <code>no-cache</code> environment variable can be set to
disable caching on a finer grained set of resources in versions
2.2.12 and later.</p>
cache_server_conf *conf;
struct cache_enable *new;
+ const char *err = ap_check_cmd_context(parms,
+ NOT_IN_DIRECTORY|NOT_IN_LIMIT|NOT_IN_FILES);
+ if (err != NULL) {
+ return err;
+ }
+
if (*type == '/') {
return apr_psprintf(parms->pool,
"provider (%s) starts with a '/'. Are url and provider switched?",
type);
}
+ if (!url) {
+ url = parms->path;
+ }
+ if (!url) {
+ return apr_psprintf(parms->pool,
+ "CacheEnable provider (%s) is missing an URL.", type);
+ }
+ if (parms->path && strncmp(parms->path, url, strlen(parms->path))) {
+ return "When in a Location, CacheEnable must specify a path or an URL below "
+ "that location.";
+ }
+
conf =
(cache_server_conf *)ap_get_module_config(parms->server->module_config,
&cache_module);
cache_server_conf *conf;
struct cache_disable *new;
+ const char *err = ap_check_cmd_context(parms,
+ NOT_IN_DIRECTORY|NOT_IN_LIMIT|NOT_IN_FILES);
+ if (err != NULL) {
+ return err;
+ }
+
+ if (parms->path && !strcmp(url, "on")) {
+ url = parms->path;
+ }
+ if (url[0] != '/' && !strchr(url, ':')) {
+ return "CacheDisable must specify a path or an URL, or when in a Location, "
+ "the word 'on'.";
+ }
+
+ if (parms->path && strncmp(parms->path, url, strlen(parms->path))) {
+ return "When in a Location, CacheDisable must specify a path or an URL below "
+ "that location.";
+ }
+
conf =
(cache_server_conf *)ap_get_module_config(parms->server->module_config,
&cache_module);
* This is more intuitive that requiring a LoadModule directive.
*/
- AP_INIT_TAKE2("CacheEnable", add_cache_enable, NULL, RSRC_CONF,
- "A cache type and partial URL prefix below which "
- "caching is enabled"),
- AP_INIT_TAKE1("CacheDisable", add_cache_disable, NULL, RSRC_CONF,
+ AP_INIT_TAKE12("CacheEnable", add_cache_enable, NULL, RSRC_CONF|ACCESS_CONF,
+ "A cache type and partial URL prefix below which "
+ "caching is enabled"),
+ AP_INIT_TAKE1("CacheDisable", add_cache_disable, NULL, RSRC_CONF|ACCESS_CONF,
"A partial URL prefix below which caching is disabled"),
AP_INIT_TAKE1("CacheMaxExpire", set_cache_maxex, NULL, RSRC_CONF,
"The maximum time in seconds to cache a document"),