1   ##
2   ##  apache-rproxy.conf -- Apache configuration for Reverse Proxy Usage
3   ##
4
5   #   server type
6   ServerType           standalone
7   Port                 80
8   MinSpareServers      <NOS>
9   StartServers         <NOS>
10   MaxSpareServers      <NOS>
11   MaxClients           <NOS>
12   MaxRequestsPerChild  10000
13
14   #   server operation parameters
15   KeepAlive            on
16   MaxKeepAliveRequests 100
17   KeepAliveTimeout     15
18   Timeout              400
19   IdentityCheck        off
20   HostnameLookups      off
21
22   #   paths to runtime files
23   PidFile       /path/to/apache-rproxy.pid
24   LockFile      /path/to/apache-rproxy.lock
25   ErrorLog      /path/to/apache-rproxy.elog
26   CustomLog     /path/to/apache-rproxy.dlog "%{%v/%T}t %h -> %{SERVER}e 
                   URL: %U"
27
28   #   unused paths
29   ServerRoot           /tmp
30   DocumentRoot         /tmp
31   CacheRoot            /tmp
32   RewriteLog           /dev/null
33   TransferLog          /dev/null
34   TypesConfig          /dev/null
35   AccessConfig         /dev/null
36   ResourceConfig       /dev/null
37
38   #   speed up and secure processing
39   <Directory />
40   Options -FollowSymLinks -SymLinksIfOwnerMatch
41   AllowOverride None
42   </Directory>
43
44   #   the status page for monitoring the reverse proxy
45   <Location /rproxy-status>
46   SetHandler server-status
47   </Location>
48
49   #   enable the URL rewriting engine
50   RewriteEngine        on
51   RewriteLogLevel      0
52
53   #   define a rewriting map with value-lists where
54   #   mod_rewrite randomly chooses a particular value
55   RewriteMap     server  rnd:/path/to/apache-rproxy.conf-servers
56
57   #   make sure the status page is handled locally
58   #   and make sure no one uses our proxy except ourself
59   RewriteRule    ^/rproxy-status.*     -   [L]
60   RewriteRule    ^(http|ftp)://.*      -   [F]
61
62   #   now choose the possible servers for particular URL types
63   RewriteRule    ^/(.*\.(cgi|shtml))$  to://${server:dynamic}/$1  
                    [S=1]
64   RewriteRule    ^/(.*)$               to://${server:static}/$1
65
66   #   and delegate the generated URL by passing it
67   #   through the proxy module
68   RewriteRule    ^to://([^/]+)/(.*)   http://$1/$2 [E=SERVER:$1,P,L]
69
70   #   and make really sure all other stuff is forbidden
71   #   when it should survive the above rules...
72   RewriteRule    .*                    -              [F]
73
74   #   enable the Proxy module without caching
75   ProxyRequests        on
76   NoCache              *
77
78   #   setup URL reverse mapping for redirect reponses
79   ProxyPassReverse  /  http://www1.foo.dom/
80   ProxyPassReverse  /  http://www2.foo.dom/
81   ProxyPassReverse  /  http://www3.foo.dom/
82   ProxyPassReverse  /  http://www4.foo.dom/
83   ProxyPassReverse  /  http://www5.foo.dom/
84   ProxyPassReverse  /  http://www6.foo.dom/