<directive module="mod_filter">AddOutputFilterByType</directive> directives.</p>
<example><title>Using buffer with mod_include</title>
- AddOutputFilterByType INCLUDES;BUFFER text/html<br />
+ <highlight language="config">
+ AddOutputFilterByType INCLUDES;BUFFER text/html
+ </highlight>
</example>
<note type="warning">The buffer filters read the request/response into
supported by this module. The <program>htcacheclean</program> tool is
provided to list cached URLs, remove cached URLs, or to maintain the size
of the disk cache within size and inode limits.</dd>
+ <dt><module>mod_cache_socache</module></dt>
+ <dd>Implements a shared object cache based storage manager. Headers and
+ bodies are stored together beneath a single key based on the URL of the
+ response being cached. Multiple content negotiated responses can
+ be stored concurrently, however the caching of partial content is not
+ supported by this module.</dd>
</dl>
<p>Further details, discussion, and examples, are provided in the
<related>
<modulelist>
<module>mod_cache_disk</module>
+ <module>mod_cache_socache</module>
</modulelist>
<directivelist>
<directive module="mod_cache_disk">CacheRoot</directive>
<directive module="mod_cache_disk">CacheDirLength</directive>
<directive module="mod_cache_disk">CacheMinFileSize</directive>
<directive module="mod_cache_disk">CacheMaxFileSize</directive>
+ <directive module="mod_cache_socache">CacheSocache</directive>
+ <directive module="mod_cache_socache">CacheSocacheMaxTime</directive>
+ <directive module="mod_cache_socache">CacheSocacheMinTime</directive>
+ <directive module="mod_cache_socache">CacheSocacheMaxSize</directive>
+ <directive module="mod_cache_socache">CacheSocacheReadSize</directive>
+ <directive module="mod_cache_socache">CacheSocacheReadTime</directive>
</directivelist>
</related>
</section>
<section id="sampleconf"><title>Sample Configuration</title>
<example><title>Sample httpd.conf</title>
- #<br />
- # Sample Cache Configuration<br />
- #<br />
- LoadModule cache_module modules/mod_cache.so<br />
- <br />
- <IfModule mod_cache.c><br />
- <indent>
- LoadModule cache_disk_module modules/mod_cache_disk.so<br />
- <IfModule mod_cache_disk.c><br />
- <indent>
- CacheRoot c:/cacheroot<br />
- CacheEnable disk /<br />
- CacheDirLevels 5<br />
- CacheDirLength 3<br />
- </indent>
- </IfModule> <br />
- <br />
- # When acting as a proxy, don't cache the list of security updates<br />
- CacheDisable http://security.update.server/update-list/<br />
- </indent>
- </IfModule>
+ <highlight language="config">
+#
+# Sample Cache Configuration
+#
+LoadModule cache_module modules/mod_cache.so
+<IfModule mod_cache.c>
+ LoadModule cache_disk_module modules/mod_cache_disk.so
+ <IfModule mod_cache_disk.c>
+ CacheRoot c:/cacheroot
+ CacheEnable disk /
+ CacheDirLevels 5
+ CacheDirLength 3
+ </IfModule>
+
+ # When acting as a proxy, don't cache the list of security updates
+ CacheDisable http://security.update.server/update-list/
+</IfModule>
+ </highlight>
</example>
</section>
<section>
<title>Example configuration</title>
<example><title>Enabling the cache lock</title>
- #<br />
- # Enable the cache lock<br />
- #<br />
- <IfModule mod_cache.c><br />
- <indent>
- CacheLock on<br />
- CacheLockPath /tmp/mod_cache-lock<br />
- CacheLockMaxAge 5<br />
- </indent>
- </IfModule>
+ <highlight language="config">
+#
+# Enable the cache lock
+#
+<IfModule mod_cache.c>
+ CacheLock on
+ CacheLockPath /tmp/mod_cache-lock
+ CacheLockMaxAge 5
+</IfModule>
+ </highlight>
</example>
</section>
</section>
place the <strong>CACHE</strong> filter before the <strong>DEFLATE</strong>
filter as in the example below:</p>
- <example>
- # Cache content before optional compression<br />
- CacheQuickHandler off<br />
- AddOutputFilterByType CACHE;DEFLATE text/plain<br /><br />
- </example>
+ <highlight language="config">
+# Cache content before optional compression
+CacheQuickHandler off
+AddOutputFilterByType CACHE;DEFLATE text/plain
+ </highlight>
<p>Another option is to have content cached before personalisation is applied
by <module>mod_include</module> (or another content processing filter). In this
example templates containing tags understood by
<module>mod_include</module> are cached before being parsed:</p>
- <example>
- # Cache content before mod_include and mod_deflate<br />
- CacheQuickHandler off<br />
- AddOutputFilterByType CACHE;INCLUDES;DEFLATE text/html<br /><br />
- </example>
+ <highlight language="config">
+# Cache content before mod_include and mod_deflate
+CacheQuickHandler off
+AddOutputFilterByType CACHE;INCLUDES;DEFLATE text/html
+ </highlight>
<p>You may place the <strong>CACHE</strong> filter anywhere you wish within the
filter chain. In this example, content is cached after being parsed by
<module>mod_include</module>, but before being processed by
<module>mod_deflate</module>:</p>
- <example>
- # Cache content between mod_include and mod_deflate<br />
- CacheQuickHandler off<br />
- AddOutputFilterByType INCLUDES;CACHE;DEFLATE text/html<br /><br />
- </example>
+ <highlight language="config">
+# Cache content between mod_include and mod_deflate
+CacheQuickHandler off
+AddOutputFilterByType INCLUDES;CACHE;DEFLATE text/html
+ </highlight>
<note type="warning"><title>Warning:</title>If the location of the
<strong>CACHE</strong> filter in the filter chain is changed for any reason,
<directive module="mod_log_config">LogFormat</directive> directive as
follows:</p>
- <example>
+ <highlight language="config">
LogFormat "%{cache-status}e ..."
- </example>
+ </highlight>
<p>Based on the caching decision made, the reason is also written to the
- subprocess environment under one the following three keys, as appropriate:</p>
+ subprocess environment under one the following four keys, as appropriate:</p>
<dl>
<dt>cache-hit</dt><dd>The response was served from cache.</dd>
<dt>cache-revalidate</dt><dd>The response was stale and was successfully
revalidated, then served from cache.</dd>
<dt>cache-miss</dt><dd>The response was served from the upstream server.</dd>
+ <dt>cache-invalidate</dt><dd>The cached entity was invalidated by a request
+ method other than GET or HEAD.</dd>
</dl>
<p>This makes it possible to support conditional logging of cached requests
as per the following example:</p>
- <example>
- CustomLog cached-requests.log common env=cache-hit<br />
- CustomLog uncached-requests.log common env=cache-miss<br />
- CustomLog revalidated-requests.log common env=cache-revalidate<br />
- </example>
+ <highlight language="config">
+CustomLog cached-requests.log common env=cache-hit
+CustomLog uncached-requests.log common env=cache-miss
+CustomLog revalidated-requests.log common env=cache-revalidate
+CustomLog invalidated-requests.log common env=cache-invalidate
+ </highlight>
<p>For module authors, a hook called <var>cache_status</var> is available,
allowing modules to respond to the caching outcomes above in customised
the content is cacheable.
<var>cache_type</var> <code>disk</code> instructs
<module>mod_cache</module> to use the disk based storage manager
- implemented by <module>mod_cache_disk</module>.</p>
+ implemented by <module>mod_cache_disk</module>. <var>cache_type</var>
+ <code>socache</code> instructs <module>mod_cache</module> to use the
+ shared object cache based storage manager implemented by
+ <module>mod_cache_socache</module>.</p>
<p>In the event that the URL space overlaps between different
<directive>CacheEnable</directive> directives (as in the example below),
each possible storage manager will be run until the first one that
also be used to specify remote sites and proxy protocols which
caching should be enabled for.</p>
- <example>
- # Cache content<br />
- <Location /foo><br />
- <indent>
- CacheEnable disk<br />
- </indent>
- </Location><br /><br />
- # Cache regex<br />
- <LocationMatch foo$><br />
- <indent>
- CacheEnable disk<br />
- </indent>
- </LocationMatch><br /><br />
- # Cache proxied url's<br />
- CacheEnable disk /<br /><br />
- # Cache FTP-proxied url's<br />
- CacheEnable disk ftp://<br /><br />
- # Cache content from www.example.org<br />
- CacheEnable disk http://www.example.org/<br />
- </example>
+ <highlight language="config">
+# Cache content
+<Location /foo>
+ CacheEnable disk
+</Location>
+
+# Cache regex
+<LocationMatch foo$>
+ CacheEnable disk
+</LocationMatch>
+
+# Cache proxied url's
+CacheEnable disk /
+
+# Cache FTP-proxied url's
+CacheEnable disk ftp://
+
+# Cache content from www.example.org
+CacheEnable disk http://www.example.org/
+ </highlight>
<p>A hostname starting with a <strong>"*"</strong> matches all hostnames with
that suffix. A hostname starting with <strong>"."</strong> matches all
hostnames containing the domain components that follow.</p>
- <example>
- # Match www.example.org, and fooexample.org<br />
- CacheEnable disk http://*example.org/<br />
- # Match www.example.org, but not fooexample.org<br />
- CacheEnable disk http://.example.org/<br />
- </example>
+ <highlight language="config">
+# Match www.example.org, and fooexample.org
+CacheEnable disk http://*example.org/
+# Match www.example.org, but not fooexample.org
+CacheEnable disk http://.example.org/
+ </highlight>
<p> The <code>no-cache</code> environment variable can be set to
disable caching on a finer grained set of resources in versions
<var>url-string</var>.</p>
<example><title>Example</title>
+ <highlight language="config">
CacheDisable /local_files
+ </highlight>
</example>
<p>If used in a <directive type="section">Location</directive> directive,
is used, caching for the whole location will be disabled.</p>
<example><title>Example</title>
- <Location /foo><br />
- <indent>
- CacheDisable on<br />
- </indent>
- </Location><br />
+ <highlight language="config">
+<Location /foo>
+ CacheDisable on
+</Location>
+ </highlight>
</example>
<p>The <code>no-cache</code> environment variable can be set to
server. Thus, documents will be out of date at most this number of seconds. This maximum
value is enforced even if an expiry date was supplied with the document.</p>
- <example>
+ <highlight language="config">
CacheMaxExpire 604800
- </example>
+ </highlight>
</usage>
</directivesynopsis>
server. This is only used if no valid expire time was supplied with the document.</p>
- <example>
+ <highlight language="config">
CacheMinExpire 3600
- </example>
+ </highlight>
</usage>
</directivesynopsis>
with the document. The value specified with the <directive>CacheMaxExpire</directive>
directive does <em>not</em> override this setting.</p>
- <example>
+ <highlight language="config">
CacheDefaultExpire 86400
- </example>
+ </highlight>
</usage>
</directivesynopsis>
<directive>CacheDefaultExpire</directive> directive will be used to
generate an expiration date.</p>
- <example>
+ <highlight language="config">
CacheIgnoreNoLastMod On
- </example>
+ </highlight>
</usage>
</directivesynopsis>
if the request contains no-cache header values. Resources requiring
authorization will <em>never</em> be cached.</p>
- <example>
+ <highlight language="config">
CacheIgnoreCacheControl On
- </example>
+ </highlight>
<note type="warning"><title>Warning:</title>
This directive will allow serving from the cache even if the client has
view the request is treated as if having no query string when this
directive is enabled.</p>
- <example>
+ <highlight language="config">
CacheIgnoreQueryString On
- </example>
+ </highlight>
</usage>
</directivesynopsis>
<directive>CacheMaxExpire</directive>, then the latter takes
precedence.</p>
- <example>
+ <highlight language="config">
CacheLastModifiedFactor 0.5
- </example>
+ </highlight>
</usage>
</directivesynopsis>
<code>None</code>.</p>
<example><title>Example 1</title>
+ <highlight language="config">
CacheIgnoreHeaders Set-Cookie
+ </highlight>
</example>
<example><title>Example 2</title>
+ <highlight language="config">
CacheIgnoreHeaders None
+ </highlight>
</example>
<note type="warning"><title>Warning:</title>
identifiers. Otherwise, each identifier is added to the list.</p>
<example><title>Example 1</title>
+ <highlight language="config">
CacheIgnoreURLSessionIdentifiers jsessionid
+ </highlight>
</example>
<example><title>Example 2</title>
+ <highlight language="config">
CacheIgnoreURLSessionIdentifiers None
+ </highlight>
</example>
</usage>
the origin server, and the response may be fulfilled from cache
if the backend resource has not changed.</p>
- <example>
+ <highlight language="config">
CacheStoreExpired On
- </example>
+ </highlight>
</usage>
</directivesynopsis>
private header values. Resources requiring authorization will
<em>never</em> be cached.</p>
- <example>
+ <highlight language="config">
CacheStorePrivate On
- </example>
+ </highlight>
<note type="warning"><title>Warning:</title>
This directive will allow caching even if the upstream server has
no-store header values. Resources requiring authorization will
<em>never</em> be cached.</p>
- <example>
+ <highlight language="config">
CacheStoreNoStore On
- </example>
+ </highlight>
<note type="warning"><title>Warning:</title>
As described in RFC 2616, the no-store directive is intended to
<p>In a minimal configuration the following directive is all that is needed to
enable the thundering herd lock in the default system temp directory.</p>
- <example>
- # Enable cache lock<br />
- CacheLock on<br /><br />
- </example>
+ <highlight language="config">
+# Enable cache lock
+CacheLock on
+ </highlight>
</usage>
</directivesynopsis>
slower than the default, it allows the cache to be used in cases where full
processing is required, such as when content is subject to authorisation.</p>
- <example>
- # Run cache as a normal handler<br />
- CacheQuickHandler off<br /><br />
- </example>
+ <highlight language="config">
+# Run cache as a normal handler
+CacheQuickHandler off
+ </highlight>
<p>It is also possible, when the quick handler is disabled, for the
administrator to choose the precise location within the filter chain where
caching is to be performed, by adding the <strong>CACHE</strong> filter to
the chain.</p>
- <example>
- # Cache content before mod_include and mod_deflate<br />
- CacheQuickHandler off<br />
- AddOutputFilterByType CACHE;INCLUDES;DEFLATE text/html<br /><br />
- </example>
+ <highlight language="config">
+# Cache content before mod_include and mod_deflate
+CacheQuickHandler off
+AddOutputFilterByType CACHE;INCLUDES;DEFLATE text/html
+ </highlight>
<p>If the CACHE filter is specified more than once, the last instance will
apply.</p>
server and was not served from cache.</dd>
</dl>
- <example>
- # Enable the X-Cache header<br />
- CacheHeader on<br />
- </example>
+ <highlight language="config">
+# Enable the X-Cache header
+CacheHeader on
+ </highlight>
- <example>
- X-Cache: HIT from localhost<br />
- </example>
+ <highlight language="config">
+ X-Cache: HIT from localhost
+ </highlight>
</usage>
</directivesynopsis>
is used, this directive must appear within a server or virtual host context, otherwise
the setting will be ignored.</p>
- <example>
- # Enable the X-Cache-Detail header<br />
- CacheDetailHeader on<br />
- </example>
+ <highlight language="config">
+# Enable the X-Cache-Detail header
+CacheDetailHeader on
+ </highlight>
<example>
X-Cache-Detail: "conditional cache hit: entity refreshed" from localhost<br />
should be cached beneath the same cache key, a new base URL can be specified
with this directive.</p>
- <example>
- # Override the base URL of the cache key.<br />
- CacheKeyBaseURL http://www.example.com/<br />
- </example>
+ <highlight language="config">
+# Override the base URL of the cache key.
+CacheKeyBaseURL http://www.example.com/
+ </highlight>
<note type="warning">Take care when setting this directive. If two separate virtual
hosts are accidentally given the same base URL, entries from one virtual host
and the raw 5xx responses returned to the client on request, the 5xx response so
returned to the client will not invalidate the content in the cache.</p>
- <example>
- # Serve stale data on error.<br />
- CacheStaleOnError on<br />
- </example>
+ <highlight language="config">
+# Serve stale data on error.
+CacheStaleOnError on
+ </highlight>
</usage>
</directivesynopsis>
cache.</p>
</note>
</summary>
+<seealso><module>mod_cache</module></seealso>
+<seealso><module>mod_cache_socache</module></seealso>
+<seealso><a href="../caching.html">Caching Guide</a></seealso>
<directivesynopsis>
<name>CacheRoot</name>
module="mod_cache_disk">CacheDirLength</directive> directives define
the structure of the directories under the specified root directory.</p>
- <example>
+ <highlight language="config">
CacheRoot c:/cacheroot
- </example>
+ </highlight>
</usage>
</directivesynopsis>
minimum size, in bytes, for a document to be considered for storage
in the cache.</p>
- <example>
+ <highlight language="config">
CacheMinFileSize 64
- </example>
+ </highlight>
</usage>
</directivesynopsis>
maximum size, in bytes, for a document to be considered for storage in
the cache.</p>
- <example>
+ <highlight language="config">
CacheMaxFileSize 64000
- </example>
+ </highlight>
</usage>
</directivesynopsis>
<p>This directive only takes effect when the data is being saved to the
cache, as opposed to data being served from the cache.</p>
- <example>
+ <highlight language="config">
CacheReadSize 102400
- </example>
+ </highlight>
</usage>
</directivesynopsis>
ensure that the server does not buffer excessively should data arrive faster
than expected.</p>
- <example>
+ <highlight language="config">
CacheReadTime 1000
- </example>
+ </highlight>
</usage>
</directivesynopsis>
accessed. Set to "<code>.</code>" to look in the same directory
as the file:</p>
- <example>MetaDir .</example>
+ <highlight language="config">MetaDir .</highlight>
<p>Or, to set it to a subdirectory of the directory containing the
files:</p>
- <example>MetaDir .meta</example>
+ <highlight language="config">MetaDir .meta</highlight>
</usage>
</directivesynopsis>
<directivesynopsis>
<name>MetaSuffix</name>
-<description>File name suffix for the file containg CERN-style
+<description>File name suffix for the file containing CERN-style
meta information</description>
<syntax>MetaSuffix <var>suffix</var></syntax>
<default>MetaSuffix .meta</default>
</p>
<example><title>Example</title>
+ <highlight language="config">
ScriptLog logs/cgi_log
+ </highlight>
</example>
<p>This log will be opened as the user the child processes run
write in the directory where the socket is located.</p>
<example><title>Example</title>
+ <highlight language="config">
ScriptSock /var/run/cgid.sock
+ </highlight>
</example>
</usage>
supported by iconv.</p>
<example><title>Example</title>
- <Directory /export/home/trawick/apacheinst/htdocs/convert><br />
- <indent>
- CharsetSourceEnc UTF-16BE<br />
- CharsetDefault ISO-8859-1<br />
- </indent>
- </Directory>
+ <highlight language="config">
+<Directory /export/home/trawick/apacheinst/htdocs/convert>
+ CharsetSourceEnc UTF-16BE
+ CharsetDefault ISO-8859-1
+</Directory>
+ </highlight>
</example>
<p>The character set names in this example work with the iconv
supported by iconv.</p>
<example><title>Example</title>
- <Directory /export/home/trawick/apacheinst/htdocs/convert><br />
- <indent>
- CharsetSourceEnc UTF-16BE<br />
- CharsetDefault ISO-8859-1<br />
- </indent>
- </Directory>
+ <highlight language="config">
+<Directory /export/home/trawick/apacheinst/htdocs/convert>
+ CharsetSourceEnc UTF-16BE
+ CharsetDefault ISO-8859-1
+</Directory>
+ </highlight>
</example>
<note>
module.</p>
<example><title>Configuring the filter</title>
- <Location /data/images><br />
- <indent>
- SetOutputFilter DATA
- </indent>
- </Location><br />
+ <highlight language="config">
+<Location /data/images>
+ SetOutputFilter DATA
+</Location>
+ </highlight>
</example>
</summary>
<p>To enable <module>mod_dav</module>, add the following to a
container in your <code>httpd.conf</code> file:</p>
- <example>Dav On</example>
+ <highlight language="config">Dav On</highlight>
<p>This enables the DAV file system provider, which is implemented
by the <module>mod_dav_fs</module> module. Therefore, that module
file using the <directive module="mod_dav_fs">DavLockDB</directive>
directive:</p>
- <example>
+ <highlight language="config">
DavLockDB /usr/local/apache2/var/DavLock
- </example>
+ </highlight>
<p>The directory containing the lock database file must be
writable by the <directive module="mod_unixd">User</directive>
requests.</p>
<example><title>Full Example</title>
- DavLockDB /usr/local/apache2/var/DavLock<br />
- <br />
- <Directory /usr/local/apache2/htdocs/foo><br />
- <indent>
- Require all granted<br />
- Dav On<br />
- <br />
- AuthType Basic<br />
- AuthName DAV<br />
- AuthUserFile user.passwd<br />
- <br />
- <LimitExcept GET POST OPTIONS><br />
- <indent>
- Require user admin<br />
- </indent>
- </LimitExcept><br />
- </indent>
- </Directory><br />
+ <highlight language="config">
+DavLockDB /usr/local/apache2/var/DavLock
+
+<Directory /usr/local/apache2/htdocs/foo>
+ Require all granted
+ Dav On
+
+ AuthType Basic
+ AuthName DAV
+ AuthUserFile user.passwd
+
+ <LimitExcept GET POST OPTIONS>
+ Require user admin
+ </LimitExcept>
+</Directory>
+ </highlight>
</example>
- <p><module>mod_dav</module> is a descendent of Greg Stein's <a
- href="http://www.webdav.org/mod_dav/">mod_dav for Apache 1.3</a>. More
- information about the module is available from that site.</p>
</section>
<section id="security"><title>Security Issues</title>
will run the script, and one of which will allow it to be
downloaded and manipulated with DAV.</p>
-<example>
-Alias /phparea /home/gstein/php_files<br />
-Alias /php-source /home/gstein/php_files<br />
+<highlight language="config">
+Alias /phparea /home/gstein/php_files
+Alias /php-source /home/gstein/php_files
<Location /php-source>
-<indent>
- DAV On<br />
- ForceType text/plain<br />
-</indent>
+ DAV On
+ ForceType text/plain
</Location>
-</example>
+</highlight>
<p>With this setup, <code>http://example.com/phparea</code> can be
used to access the output of the PHP scripts, and
<p>Use the <directive>Dav</directive> directive to enable the
WebDAV HTTP methods for the given container:</p>
- <example>
- <Location /foo><br />
- <indent>
- Dav On<br />
- </indent>
- </Location>
- </example>
+ <highlight language="config">
+<Location /foo>
+ Dav On
+</Location>
+ </highlight>
<p>The value <code>On</code> is actually an alias for the default
provider <code>filesystem</code> which is served by the <module
the lock due to network latency.</p>
<example><title>Example</title>
- <Location /MSWord><br />
- <indent>
- DavMinTimeout 600<br />
- </indent>
- </Location>
+ <highlight language="config">
+<Location /MSWord>
+ DavMinTimeout 600
+</Location>
+ </highlight>
</example>
</usage>
</directivesynopsis>
directive:</p>
<example><title>Example</title>
+ <highlight language="config">
Dav filesystem
+ </highlight>
</example>
<p>Since <code>filesystem</code> is the default provider for
the server to display all locks in a lock database.</p> -->
<example><title>Example</title>
+ <highlight language="config">
DavLockDB var/DavLock
+ </highlight>
</example>
<p>The directory containing the lock database file must be
locks.</p>
<example><title>Example</title>
+ <highlight language="config">
DavGenericLockDB var/DavLock
+ </highlight>
</example>
<p>The directory containing the lock database file must be
<p><module>mod_dbd</module> exports five functions for other modules
to use. The API is as follows:</p>
- <example>
-<pre><code>typedef struct {
+<highlight language="c">
+typedef struct {
apr_dbd_t *handle;
apr_dbd_driver_t *driver;
apr_hash_t *prepared;
APR_DECLARE_OPTIONAL_FN(ap_dbd_t*, ap_dbd_acquire, (request_rec*));
APR_DECLARE_OPTIONAL_FN(ap_dbd_t*, ap_dbd_cacquire, (conn_rec*));
APR_DECLARE_OPTIONAL_FN(void, ap_dbd_prepare, (server_rec*, const char*, const char*));
-</code></pre>
- </example>
+</highlight>
</section>
<section id="prepared"><title>SQL Prepared Statements</title>
<p>This is a simple sample configuration for the impatient.</p>
<example><title>Compress only a few types</title>
+ <highlight language="config">
AddOutputFilterByType DEFLATE text/html text/plain text/xml
+ </highlight>
</example>
<p>The following configuration, while resulting in more compressed content,
all the configuration details.</p>
<example><title>Compress everything except images</title>
- <Location /><br />
- <indent>
- # Insert filter<br />
- SetOutputFilter DEFLATE<br />
- <br />
- # Netscape 4.x has some problems...<br />
- BrowserMatch ^Mozilla/4 gzip-only-text/html<br />
- <br />
- # Netscape 4.06-4.08 have some more problems<br />
- BrowserMatch ^Mozilla/4\.0[678] no-gzip<br />
- <br />
- # MSIE masquerades as Netscape, but it is fine<br />
- BrowserMatch \bMSIE !no-gzip !gzip-only-text/html<br />
- # Don't compress images<br />
- SetEnvIfNoCase Request_URI \<br />
- <indent>
- \.(?:gif|jpe?g|png)$ no-gzip dont-vary<br />
- </indent>
- <br />
- # Make sure proxies don't deliver the wrong content<br />
- Header append Vary User-Agent env=!dont-vary<br />
- </indent>
- </Location>
+ <highlight language="config">
+<Location />
+ # Insert filter
+ SetOutputFilter DEFLATE
+
+ # Netscape 4.x has some problems...
+ BrowserMatch ^Mozilla/4 gzip-only-text/html
+
+ # Netscape 4.06-4.08 have some more problems
+ BrowserMatch ^Mozilla/4\.0[678] no-gzip
+
+ # MSIE masquerades as Netscape, but it is fine
+ BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
+ # Don't compress images
+ SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary
+
+ # Make sure proxies don't deliver the wrong content
+ Header append Vary User-Agent env=!dont-vary
+</Location>
+ </highlight>
</example>
</section>
will enable compression for documents in the container where it
is placed:</p>
- <example>
+ <highlight language="config">
SetOutputFilter DEFLATE
- </example>
+ </highlight>
<p>Some popular browsers cannot handle compression of all content
so you may want to set the <code>gzip-only-text/html</code> note to
enabling compression only for the html files of the Apache
documentation:</p>
- <example>
- <Directory "/your-server-root/manual"><br />
- <indent>
- AddOutputFilterByType DEFLATE text/html<br />
- </indent>
- </Directory>
- </example>
+ <highlight language="config">
+<Directory "/your-server-root/manual">
+ AddOutputFilterByType DEFLATE text/html
+</Directory>
+ </highlight>
<p>For browsers that have problems even with compression of all file
types, use the <directive module="mod_setenvif"
excerpt from the <a href="#recommended">configuration example</a>
defined in the section above:</p>
- <example>
- BrowserMatch ^Mozilla/4 gzip-only-text/html<br />
- BrowserMatch ^Mozilla/4\.0[678] no-gzip<br />
- BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
- </example>
+ <highlight language="config">
+BrowserMatch ^Mozilla/4 gzip-only-text/html
+BrowserMatch ^Mozilla/4\.0[678] no-gzip
+BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
+ </highlight>
<p>At first we probe for a <code>User-Agent</code> string that
indicates a Netscape Navigator version of 4.x. These versions
>SetOutputFilter</directive> or <directive module="mod_mime"
>AddOutputFilter</directive>, for example:</p>
- <example>
- <Location /dav-area><br />
- <indent>
- ProxyPass http://example.com/<br />
- SetOutputFilter INFLATE<br />
- </indent>
- </Location>
- </example>
+ <highlight language="config">
+<Location /dav-area>
+ ProxyPass http://example.com/
+ SetOutputFilter INFLATE
+</Location>
+ </highlight>
<p>This Example will uncompress gzip'ed output from example.com, so other
filters can do further processing with it.
>SetInputFilter</directive> or <directive module="mod_mime"
>AddInputFilter</directive>, for example:</p>
- <example>
- <Location /dav-area><br />
- <indent>
- SetInputFilter DEFLATE<br />
- </indent>
- </Location>
- </example>
+ <highlight language="config">
+<Location /dav-area>
+ SetInputFilter DEFLATE
+</Location>
+ </highlight>
<p>Now if a request contains a <code>Content-Encoding:
gzip</code> header, the body will be automatically decompressed.
in a typical configuration where the addition of the <code>DEFLATE</code>
filter depends on the <code>User-Agent</code>, you should add:</p>
- <example>
+ <highlight language="config">
Header append Vary User-Agent
- </example>
+ </highlight>
<p>If your decision about compression depends on other information
than request headers (<em>e.g.</em> HTTP version), you have to set the
compliant proxies from caching entirely.</p>
<example><title>Example</title>
+ <highlight language="config">
Header set Vary *
+ </highlight>
</example>
</section>
>access log</a>.</p>
<example><title>Example</title>
- DeflateFilterNote ratio<br />
- <br />
- LogFormat '"%r" %b (%{ratio}n) "%{User-agent}i"' deflate<br />
+ <highlight language="config">
+ DeflateFilterNote ratio
+
+ LogFormat '"%r" %b (%{ratio}n) "%{User-agent}i"' deflate
CustomLog logs/deflate_log deflate
+ </highlight>
</example>
<p>If you want to extract more accurate values from your logs, you
<p>Thus you may log it this way:</p>
<example><title>Accurate Logging</title>
- DeflateFilterNote Input instream<br />
- DeflateFilterNote Output outstream<br />
- DeflateFilterNote Ratio ratio<br />
- <br />
- LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%)' deflate<br />
- CustomLog logs/deflate_log deflate
+ <highlight language="config">
+DeflateFilterNote Input instream
+DeflateFilterNote Output outstream
+DeflateFilterNote Ratio ratio
+
+LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%)' deflate
+CustomLog logs/deflate_log deflate
+</highlight>
</example>
</usage>
<seealso><module>mod_log_config</module></seealso>
by the various old modem standards. So, you can browse your site with a 56k
V.92 modem, by adding something like this:</p>
-<example>
-<Location /mysite><br />
-ModemStandard V.92<br />
+<highlight language="config">
+<Location /mysite>
+ ModemStandard V.92
</Location>
-</example>
+</highlight>
<p>Previously to do bandwidth rate limiting modules would have to block an entire
thread, for each client, and insert sleeps to slow the bandwidth down.
<usage>
<p>Specify what modem standard you wish to simulate.</p>
-<example>
-<Location /mysite><br />
-ModemStandard V.26bis<br />
+<highlight language="config">
+<Location /mysite>
+ ModemStandard V.26bis
</Location>
-</example>
+</highlight>
</usage>
directory.</p>
<example><title>Example</title>
+ <highlight language="config">
DirectoryIndex index.html
+ </highlight>
</example>
<p>then a request for <code>http://example.com/docs/</code> would
<p>Note that the documents do not need to be relative to the
directory;</p>
- <example>
+ <highlight language="config">
DirectoryIndex index.html index.txt /cgi-bin/index.pl
- </example>
+ </highlight>
<p>would cause the CGI script <code>/cgi-bin/index.pl</code> to be
executed if neither <code>index.html</code> or <code>index.txt</code>
to instead be issued.</p>
<example><title>Example</title>
+ <highlight language="config">
DirectoryIndexRedirect on
+ </highlight>
</example>
<p>A request for <code>http://example.com/docs/</code> would
be aware that there are possible security implications to doing
this.</p>
- <example>
- # see security warning below!<br />
- <Location /some/path><br />
- <indent>
- DirectorySlash Off<br />
- SetHandler some-handler<br />
- </indent>
- </Location>
- </example>
+ <highlight language="config">
+# see security warning below!
+<Location /some/path>
+ DirectorySlash Off
+ SetHandler some-handler
+</Location>
+ </highlight>
<note type="warning"><title>Security Warning</title>
<p>Turning off the trailing slash redirect may result in an information
<p>Use this to set a handler for any URL that doesn't map to anything
in your filesystem, and would otherwise return HTTP 404 (Not Found).
For example</p>
- <example>
- <code>FallbackResource /not-404.php</code>
- </example>
+ <highlight language="config">
+ FallbackResource /not-404.php
+ </highlight>
<p>will cause requests for non-existent files to be handled by
<code>not-404.php</code>, while requests for files that exist
are unaffected.</p>
<module>mod_rewrite</module>, and the use of the <code>-f</code> and
<code>-d</code> tests for file and directory existence. This now
requires only one line of configuration.</p>
- <example>
- <code>FallbackResource /index.php</code>
- </example>
+ <highlight language="config">
+ FallbackResource /index.php
+ </highlight>
<p>Existing files, such as images, css files, and so on, will be
served normally.</p>
<p>In a sub-URI, such as <em>http://example.com/blog/</em> this
<em>sub-URI</em> has to be supplied as <var>local-url</var>:</p>
- <example>
- <code>
- <Directory /web/example.com/htdocs/blog><br />
- <indent>
- FallbackResource /blog/index.php<br />
- </indent>
- </Directory>
- </code>
- </example>
+ <highlight language="config">
+<Directory /web/example.com/htdocs/blog>
+ FallbackResource /blog/index.php
+</Directory>
+ </highlight>
</usage>
</directivesynopsis>
<p>To enable the module, it should be compiled and loaded
in to your running Apache configuration. Logging can then
- be enabled or disabled seperately for input and output via
+ be enabled or disabled separately for input and output via
the below directives. Additionally, <module>mod_dumpio</module>
needs to be configured to <directive
module="core">LogLevel</directive> <code>trace7</code>:
</p>
- <example>
+ <highlight language="config">
LogLevel dumpio:trace7
- </example>
+ </highlight>
</section>
<directivesynopsis>
<p>Enable dumping of all input.</p>
<example><title>Example</title>
+ <highlight language="config">
DumpIOInput On
+ </highlight>
</example>
</usage>
<p>Enable dumping of all output.</p>
<example><title>Example</title>
+ <highlight language="config">
DumpIOOutput On
+ </highlight>
</example>
</usage>