From: Rich Bowen Date: Sun, 26 Jun 2005 23:31:49 +0000 (+0000) Subject: Slightly more detail in the RewriteMap rnd: example, as well as X-Git-Tag: 2.0.55~146 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=16883b85ee2f33702d12a7b31460791afdc02466;p=thirdparty%2Fapache%2Fhttpd.git Slightly more detail in the RewriteMap rnd: example, as well as rewriting text that makes the feature sound less useful than it actually is. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.0.x@201922 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/docs/manual/mod/mod_rewrite.html.en b/docs/manual/mod/mod_rewrite.html.en index c0a3115f62f..d2dd615265d 100644 --- a/docs/manual/mod/mod_rewrite.html.en +++ b/docs/manual/mod/mod_rewrite.html.en @@ -1026,12 +1026,14 @@ RewriteMap real-to-user txt:/path/to/file/map.txt ``|'' characters which have the meaning of ``or''. In other words they indicate a set of alternatives from which the actual returned value is - chosen randomly. Although this sounds crazy and useless, - it was actually designed for load balancing in a reverse - proxy situation where the looked up values are server - names. Example:

- -
+          chosen randomly. For example, you might use the following map
+          file and directives to provide a random load balancing between
+          several back-end server, via a reverse-proxy. Images are sent
+          to one of the servers in the 'static' pool, while everything
+          else is sent to one of the 'dynamic' pool.

+

Example:

+ +

Rewrite map file

 ##
 ##  map.txt -- rewriting map
 ##
@@ -1040,8 +1042,12 @@ static   www1|www2|www3|www4
 dynamic  www5|www6
 
-

-RewriteMap servers rnd:/path/to/file/map.txt +

Configuration directives

+RewriteMap servers rnd:/path/to/file/map.txt
+
+RewriteRule ^/(.*\.(png|gif|jpg)) http://${servers:static}/$1 +[NC,P,L]
+RewriteRule ^/(.*) http://${servers:dynamic}/$1 [P,L]

diff --git a/docs/manual/mod/mod_rewrite.xml b/docs/manual/mod/mod_rewrite.xml index 1740f153f07..b8bc81cfba4 100644 --- a/docs/manual/mod/mod_rewrite.xml +++ b/docs/manual/mod/mod_rewrite.xml @@ -557,12 +557,14 @@ RewriteMap real-to-user txt:/path/to/file/map.txt ``|'' characters which have the meaning of ``or''. In other words they indicate a set of alternatives from which the actual returned value is - chosen randomly. Although this sounds crazy and useless, - it was actually designed for load balancing in a reverse - proxy situation where the looked up values are server - names. Example:

- - + chosen randomly. For example, you might use the following map + file and directives to provide a random load balancing between + several back-end server, via a reverse-proxy. Images are sent + to one of the servers in the 'static' pool, while everything + else is sent to one of the 'dynamic' pool.

+

Example:

+ +Rewrite map file
 ##
 ##  map.txt -- rewriting map
@@ -573,8 +575,12 @@ dynamic  www5|www6
 
- -RewriteMap servers rnd:/path/to/file/map.txt +Configuration directives +RewriteMap servers rnd:/path/to/file/map.txt
+
+RewriteRule ^/(.*\.(png|gif|jpg)) http://${servers:static}/$1 +[NC,P,L]
+RewriteRule ^/(.*) http://${servers:dynamic}/$1 [P,L]