From d08bbb3b62b468a8081fce31d20a992461ffa194 Mon Sep 17 00:00:00 2001
From: Daniel Gruno AddOutputFilterByType
directives.
- AddOutputFilterByType INCLUDES;BUFFER text/html
+
+ AddOutputFilterByType INCLUDES;BUFFER text/html
+
+
- #
- # 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>
+
+#
+# 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>
+
+
- #
- # Enable the cache lock
- #
- <IfModule mod_cache.c>
-
- CacheLock on
- CacheLockPath /tmp/mod_cache-lock
- CacheLockMaxAge 5
-
- </IfModule>
+
+#
+# Enable the cache lock
+#
+<IfModule mod_cache.c>
+ CacheLock on
+ CacheLockPath /tmp/mod_cache-lock
+ CacheLockMaxAge 5
+</IfModule>
+
+
- # Cache content before optional compression
- CacheQuickHandler off
- AddOutputFilterByType CACHE;DEFLATE text/plain
-
+# Cache content before optional compression +CacheQuickHandler off +AddOutputFilterByType CACHE;DEFLATE text/plain ++
Another option is to have content cached before personalisation is applied
by mod_include
(or another content processing filter). In this
example templates containing tags understood by
mod_include
are cached before being parsed:
- # Cache content before mod_include and mod_deflate
- CacheQuickHandler off
- AddOutputFilterByType CACHE;INCLUDES;DEFLATE text/html
-
+# Cache content before mod_include and mod_deflate +CacheQuickHandler off +AddOutputFilterByType CACHE;INCLUDES;DEFLATE text/html ++
You may place the CACHE filter anywhere you wish within the
filter chain. In this example, content is cached after being parsed by
mod_include
, but before being processed by
mod_deflate
:
- # Cache content between mod_include and mod_deflate
- CacheQuickHandler off
- AddOutputFilterByType INCLUDES;CACHE;DEFLATE text/html
-
+# Cache content between mod_include and mod_deflate +CacheQuickHandler off +AddOutputFilterByType INCLUDES;CACHE;DEFLATE text/html ++
LogFormat
directive as
follows:
-
+
LogFormat "%{cache-status}e ..."
-
Based on the caching decision made, the reason is also written to the subprocess environment under one the following four keys, as appropriate:
@@ -350,12 +353,13 @@This makes it possible to support conditional logging of cached requests as per the following example:
-
- 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
-
+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 ++
For module authors, a hook called cache_status is available,
allowing modules to respond to the caching outcomes above in customised
@@ -376,9 +380,10 @@
with the document. The value specified with the CacheMaxExpire
directive does not override this setting.
+
CacheDefaultExpire 86400
-
- # Enable the X-Cache-Detail header
- CacheDetailHeader on
-
+# Enable the X-Cache-Detail header +CacheDetailHeader on ++
X-Cache-Detail: "conditional cache hit: entity refreshed" from localhost
@@ -432,7 +438,10 @@
url-string.
+
CacheDisable /local_files
+
+
If used in a <Location>
directive,
@@ -440,11 +449,12 @@
is used, caching for the whole location will be disabled.
- <Location /foo>
-
- CacheDisable on
-
- </Location>
+
+<Location /foo>
+ CacheDisable on
+</Location>
+
+
The no-cache
environment variable can be set to
@@ -495,37 +505,39 @@ manager
also be used to specify remote sites and proxy protocols which
caching should be enabled for.
- # 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/
-
+# 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/ ++
A hostname starting with a "*" matches all hostnames with that suffix. A hostname starting with "." matches all hostnames containing the domain components that follow.
-
- # 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/
-
+# 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/ ++
The no-cache
environment variable can be set to
disable caching on a finer grained set of resources in versions
@@ -565,14 +577,16 @@ manager
server and was not served from cache.
-
- # Enable the X-Cache header
- CacheHeader on
-
+# Enable the X-Cache header +CacheHeader on ++ + +
+ X-Cache: HIT from localhost +-
- X-Cache: HIT from localhost
-
+
CacheIgnoreCacheControl On
-
None
.
+
CacheIgnoreHeaders Set-Cookie
+
+
+
CacheIgnoreHeaders None
+
+
CacheDefaultExpire
directive will be used to
generate an expiration date.
-
+
CacheIgnoreNoLastMod On
-
+
CacheIgnoreQueryString On
-
+
CacheIgnoreURLSessionIdentifiers jsessionid
+
+
+
CacheIgnoreURLSessionIdentifiers None
+
+
- # Override the base URL of the cache key.
- CacheKeyBaseURL http://www.example.com/
-
+# Override the base URL of the cache key. +CacheKeyBaseURL http://www.example.com/ ++
CacheMaxExpire
, then the latter takes
precedence.
-
+
CacheLastModifiedFactor 0.5
-
In a minimal configuration the following directive is all that is needed to enable the thundering herd lock in the default system temp directory.
-
- # Enable cache lock
- CacheLock on
-
+# Enable cache lock +CacheLock on ++
+
CacheMaxExpire 604800
-
+
CacheMinExpire 3600
-
- # Run cache as a normal handler
- CacheQuickHandler off
-
+# Run cache as a normal handler +CacheQuickHandler off ++
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 CACHE filter to the chain.
-
- # Cache content before mod_include and mod_deflate
- CacheQuickHandler off
- AddOutputFilterByType CACHE;INCLUDES;DEFLATE text/html
-
+# Cache content before mod_include and mod_deflate +CacheQuickHandler off +AddOutputFilterByType CACHE;INCLUDES;DEFLATE text/html ++
If the CACHE filter is specified more than once, the last instance will apply.
@@ -983,10 +1019,11 @@ LastModified date. 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. -
- # Serve stale data on error.
- CacheStaleOnError on
-
+# Serve stale data on error. +CacheStaleOnError on ++ @@ -1009,9 +1046,10 @@ LastModified date. the origin server, and the response may be fulfilled from cache if the backend resource has not changed. -
+
CacheStoreExpired On
-
+
CacheStoreNoStore On
-
+
CacheStorePrivate On
-
For example, the following two sets of directives have exactly the same effect:
-
- # CustomLog with format nickname
- LogFormat "%h %l %u %t \"%r\" %>s %b" common
- CustomLog logs/access_log common
-
- # CustomLog with explicit format string
- CustomLog logs/access_log "%h %l %u %t \"%r\" %>s %b"
-
+# CustomLog with format nickname +LogFormat "%h %l %u %t \"%r\" %>s %b" common +CustomLog logs/access_log common + +# CustomLog with explicit format string +CustomLog logs/access_log "%h %l %u %t \"%r\" %>s %b" ++
The third argument is optional and controls whether or not to log a particular request. The condition can be the @@ -436,19 +437,21 @@ expr=expression] images on your server in a separate logfile but not in your main log, you can use:
-
- SetEnvIf Request_URI \.gif$ gif-image
- CustomLog gif-requests.log common env=gif-image
- CustomLog nongif-requests.log common env=!gif-image
-
+SetEnvIf Request_URI \.gif$ gif-image +CustomLog gif-requests.log common env=gif-image +CustomLog nongif-requests.log common env=!gif-image ++
Or, to reproduce the behavior of the old RefererIgnore directive, you might use the following:
-
- SetEnvIf Referer example\.com localreferer
- CustomLog referer.log referer env=!localreferer
-
+SetEnvIf Referer example\.com localreferer +CustomLog referer.log referer env=!localreferer ++
%
).
+
LogFormat "%v %h %l %u %t \"%r\" %>s %b" vhost_common
+
+
- LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\""
- TransferLog logs/access_log
+
+LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\""
+TransferLog logs/access_log
+
+
+
LogLevel alert rewrite:trace3
+
+
+DocumentRoot /var/www/example.com Alias /myapp /opt/myapp-1.2.3 <Directory /opt/myapp-1.2.3> -RewriteEngine On -RewriteBase /myapp/ -RewriteRule ^index\.html$ welcome.html + RewriteEngine On + RewriteBase /myapp/ + RewriteRule ^index\.html$ welcome.html </Directory> -
+
RewriteCond expr "! %{HTTP_REFERER} -strmatch '*://%{HTTP_HOST}/*'"
RewriteRule ^/images - [F]
-
+RewriteCond %{REMOTE_HOST} ^host1 [OR] RewriteCond %{REMOTE_HOST} ^host2 [OR] RewriteCond %{REMOTE_HOST} ^host3 RewriteRule ...some special stuff for any of these hosts... -
User-Agent:
'' header of the request, you can
use the following:
-+RewriteCond %{HTTP_USER_AGENT} ^Mozilla RewriteRule ^/$ /homepage.max.html [L] @@ -686,7 +692,8 @@ RewriteCond %{HTTP_USER_AGENT} ^Lynx RewriteRule ^/$ /homepage.min.html [L] RewriteRule ^/$ /homepage.std.html [L] -
Explanation: If you use a browser which identifies itself as 'Mozilla' (including Netscape Navigator, Mozilla etc), then you @@ -776,16 +783,18 @@ Apache HTTP Server 2.0.41 and later
For example, you might define a
RewriteMap
as:
+
RewriteMap examplemap txt:/path/to/file/map.txt
-
You would then be able to use this map in a
RewriteRule
as follows:
+
RewriteRule ^/ex/(.*) ${examplemap:$1}
-
The following combinations for MapType and MapSource can be used:
diff --git a/docs/manual/mod/mod_rewrite.xml.fr b/docs/manual/mod/mod_rewrite.xml.fr index e99c773f19..47a943cbc0 100644 --- a/docs/manual/mod/mod_rewrite.xml.fr +++ b/docs/manual/mod/mod_rewrite.xml.fr @@ -1,7 +1,7 @@ - + diff --git a/docs/manual/mod/mod_rewrite.xml.meta b/docs/manual/mod/mod_rewrite.xml.meta index decc0a7b1e..0be21e86f4 100644 --- a/docs/manual/mod/mod_rewrite.xml.meta +++ b/docs/manual/mod/mod_rewrite.xml.meta @@ -8,6 +8,6 @@
- # In the following example, the sed filter will change the string
- # "monday" to "MON" and the string "sunday" to SUN in html documents
- # before sending to the client.
-
- <Directory "/var/www/docs/sed">
-
- AddOutputFilter Sed html
- OutputSed "s/monday/MON/g"
- OutputSed "s/sunday/SUN/g"
-
- </Directory>
-
+
+# In the following example, the sed filter will change the string
+# "monday" to "MON" and the string "sunday" to SUN in html documents
+# before sending to the client.
+<Directory "/var/www/docs/sed">
+ AddOutputFilter Sed html
+ OutputSed "s/monday/MON/g"
+ OutputSed "s/sunday/SUN/g"
+</Directory>
+
+
- # In the following example, the sed filter will change the string
- # "monday" to "MON" and the string "sunday" to SUN in the POST data
- # sent to PHP.
-
- <Directory "/var/www/docs/sed">
-
- AddInputFilter Sed php
- InputSed "s/monday/MON/g"
- InputSed "s/sunday/SUN/g"
-
- </Directory>
-
+
+# In the following example, the sed filter will change the string
+# "monday" to "MON" and the string "sunday" to SUN in the POST data
+# sent to PHP.
+<Directory "/var/www/docs/sed">
+ AddInputFilter Sed php
+ InputSed "s/monday/MON/g"
+ InputSed "s/sunday/SUN/g"
+</Directory>
+
+
netscape
if the
browser is mozilla but not MSIE.
-
- BrowserMatch ^Mozilla netscape
- BrowserMatch MSIE !netscape
-
+BrowserMatch ^Mozilla netscape +BrowserMatch MSIE !netscape ++
User-Agent
HTTP request header. The following two
lines have the same effect:
-
- BrowserMatchNoCase Robot is_a_robot
- SetEnvIfNoCase User-Agent Robot is_a_robot
-
+BrowserMatchNoCase Robot is_a_robot +SetEnvIfNoCase User-Agent Robot is_a_robot ++
Some additional examples:
-
- BrowserMatch ^Mozilla forms jpeg=yes browser=netscape
- BrowserMatch "^Mozilla/[2-3]" tables agif frames javascript
- BrowserMatch MSIE !javascript
-
+BrowserMatch ^Mozilla forms jpeg=yes browser=netscape +BrowserMatch "^Mozilla/[2-3]" tables agif frames javascript +BrowserMatch MSIE !javascript ++
BrowserMatch
directive.
However, it provides for case-insensitive matching. For
example:
-
- BrowserMatchNoCase mac platform=macintosh
- BrowserMatchNoCase win platform=windows
-
+BrowserMatchNoCase mac platform=macintosh +BrowserMatchNoCase win platform=windows ++
The BrowserMatch
and
BrowserMatchNoCase
directives are special cases of
the SetEnvIf
and SetEnvIfNoCase
directives. The following two lines have the same effect:
- BrowserMatchNoCase Robot is_a_robot
- SetEnvIfNoCase User-Agent Robot is_a_robot
-
+BrowserMatchNoCase Robot is_a_robot +SetEnvIfNoCase User-Agent Robot is_a_robot ++ @@ -221,18 +226,18 @@ of value and replace them by parenthesized subexpressions of regex. -
+
+SetEnvIf Request_URI "\.gif$" object_is_image=gif
+SetEnvIf Request_URI "\.jpg$" object_is_image=jpg
+SetEnvIf Request_URI "\.xbm$" object_is_image=xbm
+
+SetEnvIf Referer www\.mydomain\.example\.com intra_site_referral
+
+SetEnvIf object_is_image xbm XBIT_PROCESSING=1
+
+SetEnvIf ^TS ^[a-z] HAVE_TS
+
- SetEnvIf Request_URI "\.gif$" object_is_image=gif
- SetEnvIf Request_URI "\.jpg$" object_is_image=jpg
- SetEnvIf Request_URI "\.xbm$" object_is_image=xbm
- :
- SetEnvIf Referer www\.mydomain\.example\.com intra_site_referral
- :
- SetEnvIf object_is_image xbm XBIT_PROCESSING=1
- :
- SetEnvIf ^TS ^[a-z] HAVE_TS
-
The first three will set the environment variable
object_is_image
if the request was for an image
@@ -269,9 +274,10 @@ for additional examples.
ap_expr
. These expressions will be evaluated at runtime,
and applied env-variable in the same fashion as SetEnvIf
.
+
SetEnvIfExpr "tolower(req('X-Sendfile')) == 'd:\images\very_big.iso')" iso_delivered
-
This would set the environment variable iso_delivered
every time our application attempts to send it via X-Sendfile
A more useful example would be to set the variable rfc1918 if the remote IP address is a private address according to RFC 1918:
-
+
SetEnvIfExpr "-R '10.0.0.0/8' || -R '172.16.0.0/12' || -R '192.168.0.0/16'" rfc1918
-
SetEnvIf
directive,
and differs only in that the regular expression matching is
performed in a case-insensitive manner. For example:
-
+
SetEnvIfNoCase Host Example\.Org site=example
-
This will cause the site
environment variable
to be set to "example
" if the HTTP request header
diff --git a/docs/manual/mod/mod_setenvif.xml.fr b/docs/manual/mod/mod_setenvif.xml.fr
index 93d38b070e..945887af51 100644
--- a/docs/manual/mod/mod_setenvif.xml.fr
+++ b/docs/manual/mod/mod_setenvif.xml.fr
@@ -1,7 +1,7 @@
-
+
diff --git a/docs/manual/mod/mod_setenvif.xml.ja b/docs/manual/mod/mod_setenvif.xml.ja
index 0ccc9a7520..7e74bcffc2 100644
--- a/docs/manual/mod/mod_setenvif.xml.ja
+++ b/docs/manual/mod/mod_setenvif.xml.ja
@@ -1,7 +1,7 @@
-
+
+
+
+
diff --git a/docs/manual/mod/mod_so.xml.ja b/docs/manual/mod/mod_so.xml.ja
index d78a58ae0b..7427f96679 100644
--- a/docs/manual/mod/mod_so.xml.ja
+++ b/docs/manual/mod/mod_so.xml.ja
@@ -1,7 +1,7 @@
-
+
+
+
+
diff --git a/docs/manual/mod/mod_status.xml.ja b/docs/manual/mod/mod_status.xml.ja
index 9fe3a87184..dee5855839 100644
--- a/docs/manual/mod/mod_status.xml.ja
+++ b/docs/manual/mod/mod_status.xml.ja
@@ -2,7 +2,7 @@