On Thu, 2003-12-18 at 04:15, Stas Bekman wrote:
> Rob Nagler wrote:
> > Brian Hirt writes:
> > 
> >>Once everything is running on the 
> >>new mod perl, i shut down the original mod perl application.  There is 
> >>about 0.5 seconds of lag while the proxy reloads the rules.
> > 
> > 
> > We use proxies, but instead of modifying the proxy config, we use a
> > Rewrite rule of the form:
> > 
> >     RewriteMap maps txt:/etc/httpd.maps
> >     RewriteRule ^(.*) http://${maps:appserver}$1 [proxy]
> > 
> > When we release, we edit the /etc/httpd.maps file to point to a
> > different port or machine.
> > 
> >     appserver foo.com:9999
> > 
> > mod_rewrite rereads (or checks mtime of) the file on every request so
> > the change takes effect immediately.
> 
> That sounds like something that we want to have in the mod_perl documentation. 
> Would someone come up with a doc patch? I think the perfect place for this 
> would be: http://perl.apache.org/docs/1.0/guide/scenario.html

I had some free time last night so I wrote up a patch to
http://perl.apache.org/docs/1.0/guide/scenario.pod.orig. It includes
some of these list threads and splits up the examples so they are a bit
clearer to someone reading it for the first time.  Hope this can be
useful.

1657,1659d1655
< Example code for using mod_rewrite with mod_perl application servers.
Several examples were taken from the mailing list.
<
< =head2 Rewriting Requests Based on File Extension
<
1693c1689
< =head2 Internet Exporer 5 favicon.ico 404
---
> More examples:
1699,1700d1694
< =head2 Hiding Extensions for Dynamic Pages
<
1705,1706d1698
< =head2 Serving Static Content Locally and Rewriting Everything Else
<
1749,1777d1740
< =head2 Upgrading mod_perl Heavy Application Instances
<
< When using a light/heavy separation method one of the challenges of
running a production environment is being able to upgrade to newer
versions of mod_perl or your own application. The following method can
be used without having to do a server restart.
<
< Add the following rewrite rule to your httpd.conf file:
<
<   RewriteEngine On
<   RewriteMap maps txt:/etc/httpd.maps
<   RewriteRule ^(.*) http://${maps:appserver}$1 [proxy]
<
< Create the file /etc/httpd.maps and add the following entry:
<
<   appserver foo.com:9999
<
< Mod_rewrite rereads (or checks the mtime of) the file on every request
so the change takes effect immediately. To seamlessly upgrade your
application server to a new version, install a new version on a
different port. After checking for a quality installation, edit
/etc/httpd.maps to point to the new server. After the file is written
the next request the server processes will be redirected to the new
installation.
<
< =head2 Blocking IP Addresses
<
< The following rewrite code blocks IP addresses:
<
<   RewriteCond /web/site/var/blocked/REMOTE_ADDR-%{REMOTE_ADDR} -f
<   RewriteRule .* http://YOUR-HOST-BLOCKED-FOR-EXCESSIVE-CONSUMPTION
[redirect,last]
<
< To block IP address 10.1.2.3, simply touch
<
<   /web/site/var/blocked/REMOTE_ADDR-10.1.2.3
<
< This has an advantage over Apache parsing a long file of addresses in
that the OS is better at a file lookup.
<


-- 
Reporting bugs: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html

Reply via email to