From: Rich Bowen |
'' 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 ## @@ -862,8 +864,12 @@ static www1|www2|www3|www4 dynamic www5|www6- -
-RewriteMap servers rnd:/path/to/file/map.txt +
diff --git a/docs/manual/mod/mod_rewrite.xml b/docs/manual/mod/mod_rewrite.xml index ed1c60817e..13492a955e 100644 --- a/docs/manual/mod/mod_rewrite.xml +++ b/docs/manual/mod/mod_rewrite.xml @@ -356,12 +356,14 @@ RewriteMap real-to-user txt:/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]|
'' 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 @@ -372,8 +374,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]